Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
1d8a9e6f
Commit
1d8a9e6f
authored
Sep 02, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'main' function is now app::OnRun, this allows us to not enter the main loop.
parent
f2ac9c85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
src/main.cpp
src/main.cpp
+20
-15
No files found.
src/main.cpp
View file @
1d8a9e6f
...
...
@@ -30,8 +30,13 @@
*/
class
MSE
:
public
wxApp
{
public:
/// Do nothing. The command line parsing, etc. is done in OnRun
bool
OnInit
()
{
return
true
;
}
/// Main startup function of the program
bool
OnInit
();
/** Use OnRun instead of OnInit, so we can determine whether or not we need a main loop
* Also, OnExit is always run.
*/
int
OnRun
();
/// On exit: write the settings to the config file
int
OnExit
();
/// On exception: display error message
...
...
@@ -60,7 +65,7 @@ void write_stdout(const String& str) {
// ----------------------------------------------------------------------------- : Initialization
bool
MSE
::
OnInit
()
{
int
MSE
::
OnRun
()
{
try
{
#ifdef __WXMSW__
SetAppName
(
_
(
"Magic Set Editor"
));
...
...
@@ -86,12 +91,12 @@ bool MSE::OnInit() {
// Show the symbol editor
Window
*
wnd
=
new
SymbolWindow
(
nullptr
,
argv
[
1
]);
wnd
->
Show
();
return
true
;
return
wxApp
::
OnRun
()
;
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-set"
)
||
f
.
GetExt
()
==
_
(
"mse"
)
||
f
.
GetExt
()
==
_
(
"set"
))
{
// Show the set window
Window
*
wnd
=
new
SetWindow
(
nullptr
,
import_set
(
argv
[
1
]));
wnd
->
Show
();
return
true
;
return
wxApp
::
OnRun
()
;
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-installer"
))
{
// Installer; install it
bool
local
=
false
;
...
...
@@ -100,11 +105,11 @@ bool MSE::OnInit() {
local
=
arg2
==
_
(
"--local"
);
}
Installer
::
installFrom
(
argv
[
1
],
true
,
local
);
return
true
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--symbol-editor"
))
{
Window
*
wnd
=
new
SymbolWindow
(
nullptr
);
wnd
->
Show
();
return
true
;
return
wxApp
::
OnRun
()
;
}
else
if
(
arg
==
_
(
"--create-installer"
))
{
// create an installer
Installer
inst
;
...
...
@@ -116,7 +121,7 @@ bool MSE::OnInit() {
}
else
{
inst
.
saveAs
(
inst
.
prefered_filename
,
false
);
}
return
true
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--help"
)
||
arg
==
_
(
"-?"
))
{
// command line help
write_stdout
(
String
(
_
(
"Magic Set Editor
\n\n
"
))
...
...
@@ -127,29 +132,30 @@ bool MSE::OnInit() {
+
_
(
" FILE.mse
\t
Load the set file in the MSE user interface.
\n
"
)
+
_
(
" FILE.mse-symbol
\t
Load the symbol into the MSE symbol editor.
\n
"
)
+
_
(
" FILE.mse-installer
\t
Install the packages from the installer.
\n
"
)
+
_
(
" --local
\t
Install packages for this user only.
\n
"
)
+
_
(
" -? --help
\t
Shows this help screen.
\n
"
)
+
_
(
" -v --version
\t
Show version information.
\n
"
)
+
_
(
" --symbol-editor
\t
Show the symbol editor instead of the welcome window.
\n
"
)
+
_
(
" --create-installer
\n
"
)
+
_
(
" FILE [FILE]...
\t
Create an instaler named FILE, containing the listed packges.
\n
"
)
);
return
true
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--version"
)
||
arg
==
_
(
"-v"
))
{
// dump version
write_stdout
(
_
(
"Magic Set Editor
\n
Version "
)
+
app_version
.
toString
()
+
version_suffix
);
return
true
;
return
EXIT_SUCCESS
;
}
else
{
handle_error
(
_
(
"Invalid command line argument:
\n
"
)
+
String
(
argv
[
1
]));
}
}
catch
(
const
Error
&
e
)
{
handle_error
(
e
);
OnExit
();
return
false
;
return
EXIT_FAILURE
;
}
}
// no command line arguments, or error, show welcome window
(
new
WelcomeWindow
())
->
Show
();
return
true
;
return
wxApp
::
OnRun
()
;
}
catch
(
const
Error
&
e
)
{
handle_error
(
e
,
false
);
}
catch
(
const
std
::
exception
&
e
)
{
...
...
@@ -158,8 +164,7 @@ bool MSE::OnInit() {
}
catch
(...)
{
handle_error
(
InternalError
(
_
(
"An unexpected exception occurred!"
)),
false
);
}
OnExit
();
return
false
;
return
EXIT_FAILURE
;
}
// ----------------------------------------------------------------------------- : Exit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment