Navigation Menu

Skip to content

Commit

Permalink
Fixed tab update bug + minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
korslund committed Jan 19, 2012
1 parent f9e0ee3 commit 9325a0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
21 changes: 9 additions & 12 deletions tiggit.cpp
Expand Up @@ -349,7 +349,7 @@ struct SortOptions
// it later.
struct StatusNotify
{
virtual void onStatusChanged() = 0;
virtual void onDataChanged() = 0;
virtual void switchToInstalled() = 0;
};

Expand Down Expand Up @@ -796,7 +796,7 @@ struct ListTab : TabBase
*/
void statusChanged(bool newInst=false)
{
stat->onStatusChanged();
stat->onDataChanged();
if(newInst) stat->switchToInstalled();
}

Expand Down Expand Up @@ -1252,11 +1252,13 @@ class MyFrame : public wxFrame, public StatusNotify
// "Event" created internally when a list element moves from one
// list to another. This is called as a virtual function from
// StatusNotify.
void onStatusChanged()
void onDataChanged()
{
// Notify all tabs that data has changed, but keep current position.
for(int i=0; i<book->GetPageCount(); i++)
getTab(i)->dataChanged();
// Notify all tabs that data has changed
newTab->dataChanged();
freewareTab->dataChanged();
demoTab->dataChanged();
installedTab->dataChanged();

// Update tab status and titles
setupTabs();
Expand All @@ -1273,12 +1275,7 @@ class MyFrame : public wxFrame, public StatusNotify
void onRefresh(wxCommandEvent &event)
{
updateData(true);

// Notify all tabs that data has changed
for(int i=0; i<book->GetPageCount(); i++)
getTab(i)->dataChanged();

setupTabs();
onDataChanged();
}

void onAbout(wxCommandEvent &event)
Expand Down
13 changes: 11 additions & 2 deletions tigmaker.cpp
Expand Up @@ -133,7 +133,8 @@ enum MyIDs
myID_PAYPAL,

myID_SAVE,
myID_CLEAR
myID_CLEAR,
myID_WEBSITE
};

struct TheFrame : public wxFrame
Expand Down Expand Up @@ -215,6 +216,7 @@ struct TheFrame : public wxFrame
sizer->Add(buttons, 0, wxTOP, 10);
buttons->Add(new wxButton(panel, myID_SAVE, wxT("Save!")));
buttons->Add(new wxButton(panel, myID_CLEAR, wxT("Clear")));
buttons->Add(new wxButton(panel, myID_WEBSITE, wxT("Goto Website")));

clear();

Expand All @@ -228,6 +230,8 @@ struct TheFrame : public wxFrame
wxCommandEventHandler(TheFrame::onSave));
Connect(myID_CLEAR, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(TheFrame::onClear));
Connect(myID_WEBSITE, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(TheFrame::onWebsite));
}

void onTitleChange(wxCommandEvent &event)
Expand Down Expand Up @@ -339,14 +343,19 @@ struct TheFrame : public wxFrame
CurlGet::get(cmd, "response.txt");

// Visit finished site
wxLaunchDefaultBrowser(wxT("http://tiggit.net/game/" + urlname->GetValue()));
wxLaunchDefaultBrowser(wxT("http://tiggit.net/game/") + urlname->GetValue());
}

clear();
}

void onClear(wxCommandEvent &event) { clear(); }

void onWebsite(wxCommandEvent &event)
{
wxLaunchDefaultBrowser(homepage->GetValue());
}

void clear()
{
title->Clear();
Expand Down

0 comments on commit 9325a0c

Please sign in to comment.