From: John L. <jla...@gm...> - 2006-02-25 16:28:27
|
On 2/25/06, Francesco Montorsi <f18...@ya...> wrote: > Hi John, > I've created a little patch for wxLuaEdit to make it possible to > call it from command line with .lua files to open directly in the editor. > > This patch will make life a lot easier for win32 and also unix users IMO. > > Can I apply it ? Yes. > Francesco > > PS: the patch works ok when you specify zero or one file in the command > line. When you specify two or more, wxLuaEditor opens only the last. > This is not a bug with my patch but seems something scintilla-related: I > get the same behaviour using the File->Open cmd. I.e. the new files I > load do not go as additional items in the "Files" splitterwnd but rather > replace the already-open file. > Is it because of wxCVS ? You have to add files to the wxSTEditorNotebook not to the editor, add the first file to the editor and remaining ones to the notebook. See the wxstedit sample. http://cvs.sourceforge.net/viewcvs.py/wxcode/wxCode/components/wxstedit/sam= ples/stedit/wxstedit.cpp?view=3Dmarkup see the code below this comment // If there are any good files left, try to load them -John > > Index: apps/wxluaedit/src/wxluaedit.cpp > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxluaedit.cpp,v > retrieving revision 1.5 > diff -b -u -2 -r1.5 wxluaedit.cpp > --- apps/wxluaedit/src/wxluaedit.cpp 21 Feb 2006 04:20:28 -0000 1= .5 > +++ apps/wxluaedit/src/wxluaedit.cpp 25 Feb 2006 14:32:54 -0000 > @@ -21,4 +21,5 @@ > #endif > > +#include <wx/cmdline.h> > #include "wx/image.h" > #include "wx/stedit/stedit.h" > @@ -31,4 +32,24 @@ > extern bool wxLuaBinding_wxstc_init(); > > + > +// > -------------------------------------------------------------------------= --- > +// command line options > +// > -------------------------------------------------------------------------= --- > + > +static const wxCmdLineEntryDesc g_cmdLineDesc[] =3D > +{ > + // help > + { wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), > + _("Show this help message"), > + wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, > + > + // filenames to open in the editor > + { wxCMD_LINE_PARAM, wxEmptyString, wxEmptyString, > + _("lua files to open in the editor"), > + wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | > wxCMD_LINE_PARAM_MULTIPLE }, > + > + { wxCMD_LINE_NONE } > +}; > + > // > -------------------------------------------------------------------------= --- > // resources and constants > @@ -90,4 +111,9 @@ > wxLuaBinding_wxstc_init(); > > + // parse command line > + wxCmdLineParser parser(g_cmdLineDesc, argc, argv); > + if (parser.Parse() !=3D 0) > + return 0; // help was shown / an error occurred > + > wxLuaEditorFrame *frame =3D new wxLuaEditorFrame(_T("wxLuaEditor"), > wxPoint(20, 20), > wxSize(600, 400)); > @@ -115,6 +141,10 @@ > splitWin->SetSashPosition(splitWin->GetSize().y/2); > > - frame->Show(true); > > + // before showing the frame, load the file specified from > commandline, if present > + for (size_t i=3D0; i < parser.GetParamCount(); i++) > + frame->GetEditor()->LoadFile(parser.GetParam(i)); > + > + frame->Show(true); > return true; > } > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > Wxlua-users mailing list > Wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users > |