Made it so that update window and set window can't be open simultaneously (don't explode the set by deleting the style, say).

Made update window enforce dependencies
Added update button to welcome window (need icon still)


git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@756 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2007-09-25 02:02:53 +00:00
parent a57c20aa4f
commit 3ea0a4abd7
10 changed files with 153 additions and 27 deletions
+19 -9
View File
@@ -10,6 +10,7 @@
#include <gui/util.hpp>
#include <gui/new_window.hpp>
#include <gui/set/window.hpp>
#include <gui/update_checker.hpp>
#include <util/window_id.hpp>
#include <data/settings.hpp>
#include <data/format/formats.hpp>
@@ -30,11 +31,13 @@ WelcomeWindow::WelcomeWindow()
// init controls
#ifdef USE_HOVERBUTTON
wxControl* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set"));
wxControl* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("welcome_open")), _BUTTON_("open set"), _HELP_("open set"));
wxControl* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set"));
wxControl* open_set = new HoverButtonExt(this, ID_FILE_OPEN, load_resource_image(_("welcome_open")), _BUTTON_("open set"), _HELP_("open set"));
wxControl* updates = new HoverButtonExt(this, ID_FILE_CHECK_UPDATES, wxImage(), _BUTTON_("check updates"), _HELP_("check updates"));
#else
wxControl* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set"));
wxControl* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set"));
wxControl* new_set = new wxButton(this, ID_FILE_NEW, _BUTTON_("new set"));
wxControl* open_set = new wxButton(this, ID_FILE_OPEN, _BUTTON_("open set"));
wxControl* updates = new wxButton(this, ID_FILE_CHECK_UPDATES, _BUTTON_("check updates"));
#endif
wxControl* open_last = nullptr;
if (!settings.recent_sets.empty()) {
@@ -53,6 +56,7 @@ WelcomeWindow::WelcomeWindow()
s2->AddSpacer(100);
s2->Add(new_set, 0, wxALL, 2);
s2->Add(open_set, 0, wxALL, 2);
s2->Add(updates, 0, wxALL, 2);
if (open_last) s2->Add(open_last, 0, wxALL, 2);
s2->AddStretchSpacer();
s1->Add(s2);
@@ -101,6 +105,11 @@ void WelcomeWindow::onOpenLast(wxCommandEvent&) {
close( open_package<Set>(settings.recent_sets.front()) );
}
void WelcomeWindow::onCheckUpdates(wxCommandEvent&) {
(new UpdatesWindow)->Show();
Close();
}
void WelcomeWindow::close(const SetP& set) {
if (!set) return;
(new SetWindow(nullptr, set))->Show();
@@ -109,11 +118,12 @@ void WelcomeWindow::close(const SetP& set) {
BEGIN_EVENT_TABLE(WelcomeWindow, wxFrame)
EVT_BUTTON (ID_FILE_NEW, WelcomeWindow::onNewSet)
EVT_BUTTON (ID_FILE_OPEN, WelcomeWindow::onOpenSet)
EVT_BUTTON (ID_FILE_RECENT, WelcomeWindow::onOpenLast)
EVT_PAINT ( WelcomeWindow::onPaint)
// EVT_IDLE ( WelcomeWindow::onIdle)
EVT_BUTTON (ID_FILE_NEW, WelcomeWindow::onNewSet)
EVT_BUTTON (ID_FILE_OPEN, WelcomeWindow::onOpenSet)
EVT_BUTTON (ID_FILE_RECENT, WelcomeWindow::onOpenLast)
EVT_BUTTON (ID_FILE_CHECK_UPDATES, WelcomeWindow::onCheckUpdates)
EVT_PAINT ( WelcomeWindow::onPaint)
// EVT_IDLE ( WelcomeWindow::onIdle)
END_EVENT_TABLE ()