Fix: Just a touch of modernisation
- Fixing OSX Alerts to not use deprecated API - Fixing missing release for refcounted objects - Use a more conventional filename for the app delegate - Fixing some variable types to avoid conversions
This commit is contained in:
parent
95db639603
commit
381abf24ff
@ -582,7 +582,8 @@ static void toggleMute(void* userData)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct track_key defKey;
|
struct track_key defKey;
|
||||||
int i, keysSize = sizeof(struct track_key) * data->syncTrack->num_keys;
|
int i;
|
||||||
|
size_t keysSize = sizeof(struct track_key) * data->syncTrack->num_keys;
|
||||||
float currentValue = (float)sync_get_val(data->syncTrack, data->row);
|
float currentValue = (float)sync_get_val(data->syncTrack, data->row);
|
||||||
|
|
||||||
data->track->disabled = true;
|
data->track->disabled = true;
|
||||||
|
|||||||
@ -182,7 +182,7 @@ static inline int getActiveTrack()
|
|||||||
|
|
||||||
static inline int getTrackCount()
|
static inline int getTrackCount()
|
||||||
{
|
{
|
||||||
return s_editorData.trackData.num_syncTracks;
|
return (int)s_editorData.trackData.num_syncTracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1631,7 +1631,7 @@ static void onPrevNextKey(bool prevKey, enum Selection selection)
|
|||||||
|
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
row = track->keys[0].row;
|
row = track->keys[0].row;
|
||||||
else if (idx > (int)track->num_keys - 2)
|
else if (idx > track->num_keys - 2)
|
||||||
row = track->keys[track->num_keys - 1].row;
|
row = track->keys[track->num_keys - 1].row;
|
||||||
else
|
else
|
||||||
row = track->keys[idx + 1].row;
|
row = track->keys[idx + 1].row;
|
||||||
|
|||||||
@ -493,7 +493,7 @@ void RemoteConnection_sendKeyFrames(const char* name, struct sync_track* track)
|
|||||||
if (!RemoteConnection_connected() || track_id == -1)
|
if (!RemoteConnection_connected() || track_id == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < (int)track->num_keys; ++i)
|
for (i = 0; i < track->num_keys; ++i)
|
||||||
sendSetKeyCommandIndex((uint32_t)track_id, &track->keys[i]);
|
sendSetKeyCommandIndex((uint32_t)track_id, &track->keys[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -338,7 +338,7 @@ static void saveTrackData(mxml_node_t* track, struct track_key* keys, int count)
|
|||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
mxml_node_t* key = mxmlNewElement(track, "key");
|
mxml_node_t* key = mxmlNewElement(track, "key");
|
||||||
setElementInt(key, "row", "%d", (int)keys[i].row);
|
setElementInt(key, "row", "%d", keys[i].row);
|
||||||
setElementFloat(key, "value", keys[i].value);
|
setElementFloat(key, "value", keys[i].value);
|
||||||
setElementInt(key, "interpolation", "%d", (int)keys[i].type);
|
setElementInt(key, "interpolation", "%d", (int)keys[i].type);
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ int LoadSave_saveRocketXML(const text_t* path, TrackData* trackData)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
saveTrackData(track, t->keys, (int)t->num_keys);
|
saveTrackData(track, t->keys, t->num_keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ int Dialog_open(char* dest)
|
|||||||
NSOpenPanel* open = [NSOpenPanel openPanel];
|
NSOpenPanel* open = [NSOpenPanel openPanel];
|
||||||
[open setAllowsMultipleSelection:NO];
|
[open setAllowsMultipleSelection:NO];
|
||||||
|
|
||||||
int result = [open runModal];
|
NSInteger result = [open runModal];
|
||||||
|
|
||||||
if (result != NSOKButton)
|
if (result != NSModalResponseOK)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Grab the first file
|
// Grab the first file
|
||||||
@ -35,9 +35,9 @@ int Dialog_save(char* dest)
|
|||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSSavePanel* open = [NSSavePanel savePanel];
|
NSSavePanel* open = [NSSavePanel savePanel];
|
||||||
|
|
||||||
int result = [open runModal];
|
NSInteger result = [open runModal];
|
||||||
|
|
||||||
if (result != NSOKButton)
|
if (result != NSModalResponseOK)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Grab the first file
|
// Grab the first file
|
||||||
@ -149,7 +149,12 @@ void Dialog_showError(const text_t* text)
|
|||||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSString* message = [[[NSString alloc] initWithUTF8String:text] autorelease];// convert
|
NSString* message = [[[NSString alloc] initWithUTF8String:text] autorelease];// convert
|
||||||
|
|
||||||
NSRunAlertPanel(@"Error", message, @"Ok", @"", @"");
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
|
[alert addButtonWithTitle:@"OK"];
|
||||||
|
[alert setMessageText:message];
|
||||||
|
[alert setAlertStyle:NSCriticalAlertStyle];
|
||||||
|
[alert runModal];
|
||||||
|
[alert release];
|
||||||
|
|
||||||
[pool drain];
|
[pool drain];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#import "delegate.h"
|
#import "RocketAppDelegate.h"
|
||||||
#include "../Editor.h"
|
#include "../Editor.h"
|
||||||
#include "../RemoteConnection.h"
|
#include "../RemoteConnection.h"
|
||||||
#include "rlog.h"
|
#include "rlog.h"
|
||||||
@ -15,23 +15,33 @@ void Window_buildMenu();
|
|||||||
|
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
|
NSUInteger exitcode = NSTerminateNow;
|
||||||
|
|
||||||
if (!Editor_needsSave())
|
if (!Editor_needsSave())
|
||||||
return NSTerminateNow;
|
return exitcode;
|
||||||
|
|
||||||
int ret = NSRunAlertPanel(@"Save before exit?", @"Do you want save the work?", @"Yes", @"Cancel", @"No");
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
|
[alert addButtonWithTitle:@"Yes"];
|
||||||
|
[alert addButtonWithTitle:@"No"];
|
||||||
|
[alert addButtonWithTitle:@"Cancel"];
|
||||||
|
[alert setMessageText:@"Save before exit?"];
|
||||||
|
[alert setInformativeText:@"Do you want save the work?"];
|
||||||
|
[alert setAlertStyle:NSWarningAlertStyle];
|
||||||
|
|
||||||
if (ret == NSAlertDefaultReturn)
|
NSModalResponse ret = [alert runModal];
|
||||||
|
|
||||||
|
if (ret == NSAlertFirstButtonReturn)
|
||||||
{
|
{
|
||||||
if (!Editor_saveBeforeExit())
|
if (!Editor_saveBeforeExit())
|
||||||
return NSTerminateCancel;
|
exitcode = NSTerminateCancel;
|
||||||
|
|
||||||
return NSTerminateNow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == NSAlertAlternateReturn)
|
if (ret == NSAlertThirdButtonReturn)
|
||||||
return NSTerminateCancel;
|
exitcode = NSTerminateCancel;
|
||||||
|
|
||||||
return NSTerminateNow;
|
[alert release];
|
||||||
|
|
||||||
|
return exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -87,6 +97,7 @@ void Window_buildMenu();
|
|||||||
|
|
||||||
Editor_destroy();
|
Editor_destroy();
|
||||||
RemoteConnection_close();
|
RemoteConnection_close();
|
||||||
|
[stringArray release];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -7,8 +7,8 @@
|
|||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
NSOpenGLContext* g_context = 0;
|
NSOpenGLContext* g_context = nil;
|
||||||
NSWindow* g_window = 0;
|
NSWindow* g_window = nil;
|
||||||
|
|
||||||
void Window_setTitle(const char* title);
|
void Window_setTitle(const char* title);
|
||||||
|
|
||||||
@ -52,13 +52,14 @@ void Window_setTitle(const char* title);
|
|||||||
if (self == nil)
|
if (self == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
NSOpenGLPixelFormatAttribute attributes[4];
|
NSOpenGLPixelFormatAttribute attributes[] = {
|
||||||
|
NSOpenGLPFADoubleBuffer,
|
||||||
attributes[0] = NSOpenGLPFADoubleBuffer;
|
0
|
||||||
attributes[1] = 0;
|
};
|
||||||
|
|
||||||
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
oglContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
|
oglContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
|
||||||
|
[format release];
|
||||||
[oglContext makeCurrentContext];
|
[oglContext makeCurrentContext];
|
||||||
|
|
||||||
g_context = oglContext;
|
g_context = oglContext;
|
||||||
@ -185,6 +186,7 @@ static int getModifierFlags(int flags)
|
|||||||
owner:self
|
owner:self
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
[self addTrackingArea:trackingArea];
|
[self addTrackingArea:trackingArea];
|
||||||
|
[trackingArea release];
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -296,7 +298,7 @@ CFStringRef createStringForKey(CGKeyCode keyCode)
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static int s_characterToKeyCode[] =
|
static CGKeyCode s_characterToKeyCode[] =
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0x27, // '''
|
0x27, // '''
|
||||||
@ -383,11 +385,11 @@ NSString* convertKeyCodeToString(int key)
|
|||||||
case EMGUI_KEY_BACKSPACE : return [NSString stringWithFormat:@"%C",(uint16_t)0x232b];
|
case EMGUI_KEY_BACKSPACE : return [NSString stringWithFormat:@"%C",(uint16_t)0x232b];
|
||||||
case EMGUI_KEY_TAB : return [NSString stringWithFormat:@"%C",(uint16_t)0x21e4];
|
case EMGUI_KEY_TAB : return [NSString stringWithFormat:@"%C",(uint16_t)0x21e4];
|
||||||
case EMGUI_KEY_PAGE_UP : return [NSString stringWithFormat:@"%C",(uint16_t)0x21de];
|
case EMGUI_KEY_PAGE_UP : return [NSString stringWithFormat:@"%C",(uint16_t)0x21de];
|
||||||
case EMGUI_KEY_PAGE_DOWN : return [NSString stringWithFormat:@"%C",(uint16_t)0x21df];
|
case EMGUI_KEY_PAGE_DOWN : return [NSString stringWithFormat:@"%C",(uint16_t)0x21df];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -407,8 +409,8 @@ void buildSubMenu(NSMenu* menu, MenuDescriptor menuDesc[])
|
|||||||
}
|
}
|
||||||
else if (desc->id == EDITOR_MENU_SUB_MENU)
|
else if (desc->id == EDITOR_MENU_SUB_MENU)
|
||||||
{
|
{
|
||||||
MyMenuItem* newItem = [[MyMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:name action:NULL keyEquivalent:@""];
|
MyMenuItem* newItem = [[MyMenuItem alloc] initWithTitle:name action:NULL keyEquivalent:@""];
|
||||||
NSMenu* newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:name];
|
NSMenu* newMenu = [[NSMenu alloc] initWithTitle:name];
|
||||||
[newItem setSubmenu:newMenu];
|
[newItem setSubmenu:newMenu];
|
||||||
[newMenu release];
|
[newMenu release];
|
||||||
[menu addItem:newItem];
|
[menu addItem:newItem];
|
||||||
@ -416,7 +418,7 @@ void buildSubMenu(NSMenu* menu, MenuDescriptor menuDesc[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int mask = 0;
|
NSUInteger mask = 0;
|
||||||
MyMenuItem* newItem = [[MyMenuItem alloc] initWithTitle:name action:@selector(onMenuPress:) keyEquivalent:@""];
|
MyMenuItem* newItem = [[MyMenuItem alloc] initWithTitle:name action:@selector(onMenuPress:) keyEquivalent:@""];
|
||||||
[newItem setTag:desc->id];
|
[newItem setTag:desc->id];
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#import <OpenGL/OpenGL.h>
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, const char * argv[])
|
||||||
{
|
{
|
||||||
return NSApplicationMain(argc, (const char **) argv);
|
return NSApplicationMain(argc, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user