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
fc395f0f
Commit
fc395f0f
authored
Mar 20, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GUI for changing the locale
parent
2560ae4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
7 deletions
+58
-7
src/gui/preferences_window.cpp
src/gui/preferences_window.cpp
+58
-7
No files found.
src/gui/preferences_window.cpp
View file @
fc395f0f
...
...
@@ -10,6 +10,7 @@
#include <gui/update_checker.hpp>
#include <data/settings.hpp>
#include <util/window_id.hpp>
#include <util/io/package_manager.hpp>
#include <wx/spinctrl.h>
#include <wx/filename.h>
...
...
@@ -26,6 +27,16 @@ class PreferencesPage : public wxPanel {
virtual
void
store
()
=
0
;
};
// Preferences page for global MSE settings
class
GlobalPreferencesPage
:
public
PreferencesPage
{
public:
GlobalPreferencesPage
(
Window
*
parent
);
void
store
();
private:
wxComboBox
*
language
;
};
// Preferences page for card viewing related settings
class
DisplayPreferencesPage
:
public
PreferencesPage
{
public:
...
...
@@ -81,6 +92,7 @@ PreferencesWindow::PreferencesWindow(Window* parent)
{
// init notebook
wxNotebook
*
nb
=
new
wxNotebook
(
this
,
ID_NOTEBOOK
);
nb
->
AddPage
(
new
GlobalPreferencesPage
(
nb
),
_TITLE_
(
"global"
));
nb
->
AddPage
(
new
DisplayPreferencesPage
(
nb
),
_TITLE_
(
"display"
));
nb
->
AddPage
(
new
DirsPreferencesPage
(
nb
),
_TITLE_
(
"directories"
));
nb
->
AddPage
(
new
UpdatePreferencesPage
(
nb
),
_TITLE_
(
"updates"
));
...
...
@@ -110,6 +122,43 @@ BEGIN_EVENT_TABLE(PreferencesWindow, wxDialog)
END_EVENT_TABLE
()
// ----------------------------------------------------------------------------- : Preferences page : global
GlobalPreferencesPage
::
GlobalPreferencesPage
(
Window
*
parent
)
:
PreferencesPage
(
parent
)
{
// init controls
language
=
new
wxComboBox
(
this
,
wxID_ANY
,
_
(
""
),
wxDefaultPosition
,
wxDefaultSize
,
0
,
nullptr
,
wxCB_READONLY
|
wxCB_SORT
);
// set values
String
f
=
::
packages
.
findFirst
(
_
(
"*.mse-locale"
));
int
n
=
0
;
while
(
!
f
.
empty
())
{
PackagedP
package
=
packages
.
openAny
(
f
);
language
->
Append
(
package
->
name
()
+
_
(
": "
)
+
package
->
full_name
,
package
.
get
());
if
(
settings
.
locale
==
package
->
name
())
{
language
->
SetSelection
(
n
);
}
f
=
wxFindNextFile
();
}
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
s
->
SetSizeHints
(
this
);
wxSizer
*
s2
=
new
wxStaticBoxSizer
(
wxVERTICAL
,
this
,
_LABEL_
(
"language"
));
s2
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_LABEL_
(
"app language"
)),
0
,
wxALL
,
4
);
s2
->
Add
(
language
,
0
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
4
);
s2
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_HELP_
(
"app language"
)),
0
,
wxALL
&
~
wxTOP
,
4
);
s
->
Add
(
s2
,
0
,
wxALL
|
wxEXPAND
,
8
);
SetSizer
(
s
);
}
void
GlobalPreferencesPage
::
store
()
{
int
n
=
language
->
GetSelection
();
if
(
n
==
wxNOT_FOUND
)
return
;
Packaged
*
p
=
(
Packaged
*
)
language
->
GetClientData
(
n
);
settings
.
locale
=
p
->
name
();
// set the_locale?
}
// ----------------------------------------------------------------------------- : Preferences page : display
DisplayPreferencesPage
::
DisplayPreferencesPage
(
Window
*
parent
)
...
...
@@ -120,7 +169,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
borders
=
new
wxCheckBox
(
this
,
wxID_ANY
,
_BUTTON_
(
"show lines"
));
zoom
=
new
wxSpinCtrl
(
this
,
wxID_ANY
);
non_normal_export
=
new
wxCheckBox
(
this
,
wxID_ANY
,
_BUTTON_
(
"zoom export"
));
wxButton
*
columns
=
new
wxButton
(
this
,
ID_SELECT_COLUMNS
,
_BUTTON_
(
"select"
));
//
wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select"));
// set values
high_quality
->
SetValue
(
settings
.
default_stylesheet_settings
.
card_anti_alias
());
borders
->
SetValue
(
settings
.
default_stylesheet_settings
.
card_borders
());
...
...
@@ -129,23 +178,25 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
zoom
->
SetValue
(
static_cast
<
int
>
(
settings
.
default_stylesheet_settings
.
card_zoom
()
*
100
));
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
s2
=
new
wxStaticBoxSizer
(
wxVERTICAL
,
this
,
_
(
"Card D
isplay"
));
wxSizer
*
s2
=
new
wxStaticBoxSizer
(
wxVERTICAL
,
this
,
_
LABEL_
(
"card d
isplay"
));
s2
->
Add
(
high_quality
,
0
,
wxEXPAND
|
wxALL
,
4
);
s2
->
Add
(
borders
,
0
,
wxEXPAND
|
wxALL
,
4
);
wxSizer
*
s3
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s3
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"&Zoom:"
)),
0
,
wxALL
&
~
wxLEFT
,
4
);
s3
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_
LABEL_
(
"zoom"
)),
0
,
wxALL
&
~
wxLEFT
,
4
);
s3
->
Add
(
zoom
);
s3
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"% of normal size
"
)),
1
,
wxALL
&
~
wxRIGHT
,
4
);
s3
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_
LABEL_
(
"percent of normal
"
)),
1
,
wxALL
&
~
wxRIGHT
,
4
);
s2
->
Add
(
s3
,
0
,
wxEXPAND
|
wxALL
,
4
);
s2
->
Add
(
non_normal_export
,
0
,
wxEXPAND
|
wxALL
,
4
);
s2
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"(When off the cards are exported
\n
and copied at 100% size and normal rotation)"
)),
0
,
wxALL
&
~
wxTOP
,
4
);
s2
->
Add
(
new
wxStaticText
(
this
,
wxID_ANY
,
_HELP_
(
"zoom export"
)),
0
,
wxALL
&
~
wxTOP
,
4
);
s
->
Add
(
s2
,
0
,
wxEXPAND
|
wxALL
,
8
);
/*
wxSizer* s4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Card List"));
wxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
s5->Add(new wxStaticText(this, wxID_ANY, _("Columns: ")), 0, wxALL & ~wxLEFT | wxEXPAND, 4);
s5->Add(columns);
s4->Add(s5, 0, wxEXPAND | wxALL, 4);
s->Add(s4, 0, wxEXPAND | wxALL & ~wxTOP, 8);
*/
s
->
SetSizeHints
(
this
);
SetSizer
(
s
);
}
...
...
@@ -158,7 +209,7 @@ void DisplayPreferencesPage::store() {
}
void
DisplayPreferencesPage
::
onSelectColumns
(
wxCommandEvent
&
)
{
//
TODO
//
Impossible, set specific
}
BEGIN_EVENT_TABLE
(
DisplayPreferencesPage
,
wxPanel
)
...
...
@@ -195,7 +246,7 @@ void DirsPreferencesPage::store() {
void
DirsPreferencesPage
::
onApprenticeBrowse
(
wxCommandEvent
&
)
{
// browse for appr.exe
wxFileDialog
dlg
(
this
,
_TITLE_
(
"locate apprentice"
),
apprentice
->
GetValue
(),
_
(
""
),
_
(
"Apprentice Executable
|appr.exe"
),
wxOPEN
);
wxFileDialog
dlg
(
this
,
_TITLE_
(
"locate apprentice"
),
apprentice
->
GetValue
(),
_
(
""
),
_
LABEL_
(
"apprentice exe"
)
+
_
(
"
|appr.exe"
),
wxOPEN
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
wxFileName
fn
(
dlg
.
GetPath
());
apprentice
->
SetValue
(
fn
.
GetPath
());
...
...
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