mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Merge pull request #51 from haganbmj/apply-from-forks
Add Language selector to Welcome Window
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ version 2.3.2 (Unofficial), 2022-09-14
|
|||||||
Features:
|
Features:
|
||||||
* Script functions for generating and manipulating card images. (haganbmj#34)
|
* Script functions for generating and manipulating card images. (haganbmj#34)
|
||||||
* Stylesheet properties for defining card regions. (haganbmj#34)
|
* Stylesheet properties for defining card regions. (haganbmj#34)
|
||||||
* Updated Spanish locale translations. (haganbmj$49)
|
* Updated Spanish locale translations. (haganbmj#49)
|
||||||
* Disable update checking on startup.
|
* Disable update checking on startup.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void AboutWindow::onPaint(wxPaintEvent& ev) {
|
|||||||
draw(dc);
|
draw(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MSE_AUTHORS[] = {"Twan van Laarhoven (twanvl)", "Sean Hunt (coppro)", "Alissa Rao (Lymia)"};
|
const char* MSE_AUTHORS[] = {"Twan van Laarhoven (twanvl)", "Sean Hunt (coppro)", "Alissa Rao (Lymia)", "haganbmj", "CaiCai (247321453)"};
|
||||||
|
|
||||||
void AboutWindow::draw(DC& dc) {
|
void AboutWindow::draw(DC& dc) {
|
||||||
wxSize ws = GetClientSize();
|
wxSize ws = GetClientSize();
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ void StylingEditor::onChangeSet() {
|
|||||||
// ----------------------------------------------------------------------------- : ExportOptionsEditor
|
// ----------------------------------------------------------------------------- : ExportOptionsEditor
|
||||||
|
|
||||||
ExportOptionsEditor::ExportOptionsEditor(Window* parent, int id, long style)
|
ExportOptionsEditor::ExportOptionsEditor(Window* parent, int id, long style)
|
||||||
: NativeLookEditor(parent, id, style)
|
: NativeLookEditor(parent, id, style | wxVSCROLL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void ExportOptionsEditor::showExport(const ExportTemplateP& export_template) {
|
void ExportOptionsEditor::showExport(const ExportTemplateP& export_template) {
|
||||||
|
|||||||
@@ -18,12 +18,17 @@
|
|||||||
#include <data/format/formats.hpp>
|
#include <data/format/formats.hpp>
|
||||||
#include <wx/dcbuffer.h>
|
#include <wx/dcbuffer.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
#include <util/io/package_manager.hpp>
|
||||||
|
#include <data/locale.hpp>
|
||||||
|
|
||||||
// 2007-02-06: New HoverButton, hopefully this on works on GTK
|
// 2007-02-06: New HoverButton, hopefully this on works on GTK
|
||||||
#define USE_HOVERBUTTON
|
#define USE_HOVERBUTTON
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : WelcomeWindow
|
// ----------------------------------------------------------------------------- : WelcomeWindow
|
||||||
|
|
||||||
|
bool __compare_package_name(const PackagedP& a, const PackagedP& b) {
|
||||||
|
return a->name() < b->name();
|
||||||
|
}
|
||||||
WelcomeWindow::WelcomeWindow()
|
WelcomeWindow::WelcomeWindow()
|
||||||
: wxFrame(nullptr, wxID_ANY, _TITLE_("magic set editor"), wxDefaultPosition, wxSize(520,380), wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL | wxCLIP_CHILDREN )
|
: wxFrame(nullptr, wxID_ANY, _TITLE_("magic set editor"), wxDefaultPosition, wxSize(520,380), wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL | wxCLIP_CHILDREN )
|
||||||
, logo (load_resource_image(_("about")))
|
, logo (load_resource_image(_("about")))
|
||||||
@@ -58,6 +63,26 @@ WelcomeWindow::WelcomeWindow()
|
|||||||
#endif
|
#endif
|
||||||
if (open_last) s2->Add(open_last, 0, wxALL, 2);
|
if (open_last) s2->Add(open_last, 0, wxALL, 2);
|
||||||
s2->AddStretchSpacer();
|
s2->AddStretchSpacer();
|
||||||
|
|
||||||
|
//
|
||||||
|
select_language = new wxComboBox(this, ID_SELECT_LANGUAGE, _(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
|
||||||
|
// set values
|
||||||
|
vector<PackagedP> locales;
|
||||||
|
package_manager.findMatching(_("*.mse-locale"), locales);
|
||||||
|
sort(locales.begin(), locales.end(), __compare_package_name);
|
||||||
|
int n = 0;
|
||||||
|
FOR_EACH(package, locales) {
|
||||||
|
select_language->Append(package->full_name, package.get());
|
||||||
|
if (settings.locale == package->name()) {
|
||||||
|
select_language->SetSelection(n);
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
s3->AddSpacer(280);
|
||||||
|
s3->Add(select_language, 0, wxALL, 1);
|
||||||
|
s2->AddSpacer(30);
|
||||||
|
s2->Add(s3);
|
||||||
s1->Add(s2);
|
s1->Add(s2);
|
||||||
SetSizer(s1);
|
SetSizer(s1);
|
||||||
}
|
}
|
||||||
@@ -87,6 +112,19 @@ void WelcomeWindow::draw(DC& dc) {
|
|||||||
dc.DrawText(version_string, 4, ws.GetHeight()-th-4);
|
dc.DrawText(version_string, 4, ws.GetHeight()-th-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WelcomeWindow::onSelectLanguage(wxCommandEvent&) {
|
||||||
|
// locale
|
||||||
|
int n = select_language->GetSelection();
|
||||||
|
if (n == wxNOT_FOUND) return;
|
||||||
|
Packaged* p = (Packaged*)select_language->GetClientData(n);
|
||||||
|
settings.locale = p->name();
|
||||||
|
the_locale = Locale::byName(settings.locale);
|
||||||
|
|
||||||
|
//close app
|
||||||
|
(new WelcomeWindow())->Show();
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
void WelcomeWindow::onOpenSet(wxCommandEvent&) {
|
void WelcomeWindow::onOpenSet(wxCommandEvent&) {
|
||||||
wxFileDialog* dlg = new wxFileDialog(this, _TITLE_("open set"), settings.default_set_dir, wxEmptyString, import_formats(), wxFD_OPEN);
|
wxFileDialog* dlg = new wxFileDialog(this, _TITLE_("open set"), settings.default_set_dir, wxEmptyString, import_formats(), wxFD_OPEN);
|
||||||
if (dlg->ShowModal() == wxID_OK) {
|
if (dlg->ShowModal() == wxID_OK) {
|
||||||
@@ -133,9 +171,10 @@ BEGIN_EVENT_TABLE(WelcomeWindow, wxFrame)
|
|||||||
EVT_BUTTON (ID_FILE_NEW, WelcomeWindow::onNewSet)
|
EVT_BUTTON (ID_FILE_NEW, WelcomeWindow::onNewSet)
|
||||||
EVT_BUTTON (ID_FILE_OPEN, WelcomeWindow::onOpenSet)
|
EVT_BUTTON (ID_FILE_OPEN, WelcomeWindow::onOpenSet)
|
||||||
EVT_BUTTON (ID_FILE_RECENT, WelcomeWindow::onOpenLast)
|
EVT_BUTTON (ID_FILE_RECENT, WelcomeWindow::onOpenLast)
|
||||||
|
EVT_COMBOBOX (ID_SELECT_LANGUAGE, WelcomeWindow::onSelectLanguage)
|
||||||
EVT_BUTTON (ID_FILE_CHECK_UPDATES, WelcomeWindow::onCheckUpdates)
|
EVT_BUTTON (ID_FILE_CHECK_UPDATES, WelcomeWindow::onCheckUpdates)
|
||||||
EVT_PAINT ( WelcomeWindow::onPaint)
|
EVT_PAINT ( WelcomeWindow::onPaint)
|
||||||
// EVT_IDLE ( WelcomeWindow::onIdle)
|
// EVT_IDLE ( WelcomeWindow::onIdle)
|
||||||
END_EVENT_TABLE ()
|
END_EVENT_TABLE ()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ private:
|
|||||||
#if USE_BETA_LOGO
|
#if USE_BETA_LOGO
|
||||||
Bitmap logo2;
|
Bitmap logo2;
|
||||||
#endif
|
#endif
|
||||||
|
wxComboBox* select_language;
|
||||||
|
|
||||||
void onPaint(wxPaintEvent&);
|
void onPaint(wxPaintEvent&);
|
||||||
void draw(DC& dc);
|
void draw(DC& dc);
|
||||||
@@ -43,6 +44,7 @@ private:
|
|||||||
void onNewSet (wxCommandEvent&);
|
void onNewSet (wxCommandEvent&);
|
||||||
void onOpenLast (wxCommandEvent&);
|
void onOpenLast (wxCommandEvent&);
|
||||||
void onCheckUpdates(wxCommandEvent&);
|
void onCheckUpdates(wxCommandEvent&);
|
||||||
|
void onSelectLanguage(wxCommandEvent&);
|
||||||
// void onIdle (wxIdleEvent& ev);
|
// void onIdle (wxIdleEvent& ev);
|
||||||
|
|
||||||
/// Close the welcome window, and show the given set
|
/// Close the welcome window, and show the given set
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ enum MenuID {
|
|||||||
ID_MODE_SYMMETRY,
|
ID_MODE_SYMMETRY,
|
||||||
ID_MODE_PAINT,
|
ID_MODE_PAINT,
|
||||||
ID_MODE_MAX,
|
ID_MODE_MAX,
|
||||||
|
|
||||||
|
// Welcome Window
|
||||||
|
ID_SELECT_LANGUAGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user