Command line file loading, fixes #9

This commit is contained in:
Tim Warren 2015-05-19 12:12:12 -04:00
parent 7fd17e2120
commit 16ba492e6b

View File

@ -14,6 +14,10 @@ TyroMenu *Glob_menu_bar;
MainFrame *Glob_main_frame; MainFrame *Glob_main_frame;
StringConstMap Glob_lexer_map; StringConstMap Glob_lexer_map;
// Static app loading variables
static wxArrayString files;
static int param_count;
/** /**
* Class with main method * Class with main method
*/ */
@ -42,6 +46,12 @@ public:
Glob_main_frame->Layout(); Glob_main_frame->Layout();
Glob_main_frame->CenterOnScreen(); Glob_main_frame->CenterOnScreen();
Glob_main_frame->Show(true); Glob_main_frame->Show(true);
// Open passed files
if (param_count > 0)
{
Glob_main_frame->OpenFiles(files);
}
SetTopWindow(Glob_main_frame); SetTopWindow(Glob_main_frame);
@ -86,19 +96,13 @@ public:
// Get un-named parameters // Get un-named parameters
wxArrayString files; wxArrayString files;
int i; int i;
int param_count = parser.GetParamCount(); param_count = parser.GetParamCount();
wxLogDebug("%i Parameters", param_count); wxLogDebug("%i Parameters", param_count);
for (i = 0; i < param_count; i++) for (i = 0; i < param_count; i++)
{ {
files.Add(parser.GetParam(i)); Glob_files.Add(parser.GetParam(i));
}
// Open files in editor, if any are passed
if (param_count > 0)
{
Glob_main_frame->OpenFiles(files);
} }
return true; return true;