by date turns white like my own does when selected

This commit is contained in:
jacob1
2013-03-04 15:27:51 -05:00
parent 0f5b4a9ec8
commit 38573cc30e
3 changed files with 226 additions and 223 deletions

View File

@@ -42,7 +42,7 @@ GameModel::GameModel():
std::fill(decoToolset, decoToolset+3, (Tool*)NULL);
std::fill(regularToolset, regularToolset+3, (Tool*)NULL);
//Default render prefs
//Default render prefs
std::vector<unsigned int> tempArray;
tempArray.push_back(RENDER_FIRE);
tempArray.push_back(RENDER_EFFE);

View File

@@ -52,14 +52,14 @@ public:
void SetSplitActionCallback(SplitButtonAction * newAction) { splitActionCallback = newAction; }
virtual void OnMouseUnclick(int x, int y, unsigned int button)
{
if(isButtonDown)
{
if(leftDown)
if(isButtonDown)
{
if(leftDown)
DoLeftAction();
else if(rightDown)
DoRightAction();
}
ui::Button::OnMouseUnclick(x, y, button);
}
ui::Button::OnMouseUnclick(x, y, button);
}
virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
@@ -81,7 +81,7 @@ public:
}
virtual void OnMouseEnter(int x, int y)
{
isMouseInside = true;
isMouseInside = true;
if(!Enabled)
return;
if(x >= splitPosition || !showSplit)
@@ -218,170 +218,170 @@ GameView::GameView():
searchButton->SetActionCallback(new SearchAction(this));
AddComponent(searchButton);
class ReloadAction : public ui::ButtonAction
{
GameView * v;
public:
ReloadAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->ReloadSim();
}
void AltActionCallback(ui::Button * sender)
{
v->c->OpenSavePreview();
}
};
reloadButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15), "", "Reload the simulation");
reloadButton->SetIcon(IconReload);
reloadButton->Appearance.Margin.Left+=2;
currentX+=18;
reloadButton->SetActionCallback(new ReloadAction(this));
AddComponent(reloadButton);
class ReloadAction : public ui::ButtonAction
{
GameView * v;
public:
ReloadAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->ReloadSim();
}
void AltActionCallback(ui::Button * sender)
{
v->c->OpenSavePreview();
}
};
reloadButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15), "", "Reload the simulation");
reloadButton->SetIcon(IconReload);
reloadButton->Appearance.Margin.Left+=2;
currentX+=18;
reloadButton->SetActionCallback(new ReloadAction(this));
AddComponent(reloadButton);
class SaveSimulationAction : public SplitButtonAction
{
GameView * v;
public:
SaveSimulationAction(GameView * _v) { v = _v; }
void ActionCallbackRight(ui::Button * sender)
{
if(v->CtrlBehaviour())
v->c->OpenLocalSaveWindow(false);
else
v->c->OpenSaveWindow();
}
void ActionCallbackLeft(ui::Button * sender)
{
if(v->CtrlBehaviour())
v->c->OpenLocalSaveWindow(true);
else
v->c->SaveAsCurrent();
}
};
saveSimulationButton = new SplitButton(ui::Point(currentX, Size.Y-16), ui::Point(150, 15), "[untitled simulation]", "Save game as current name", "Save game as new name", 19);
class SaveSimulationAction : public SplitButtonAction
{
GameView * v;
public:
SaveSimulationAction(GameView * _v) { v = _v; }
void ActionCallbackRight(ui::Button * sender)
{
if(v->CtrlBehaviour())
v->c->OpenLocalSaveWindow(false);
else
v->c->OpenSaveWindow();
}
void ActionCallbackLeft(ui::Button * sender)
{
if(v->CtrlBehaviour())
v->c->OpenLocalSaveWindow(true);
else
v->c->SaveAsCurrent();
}
};
saveSimulationButton = new SplitButton(ui::Point(currentX, Size.Y-16), ui::Point(150, 15), "[untitled simulation]", "Save game as current name", "Save game as new name", 19);
saveSimulationButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
saveSimulationButton->SetIcon(IconSave);
currentX+=151;
((SplitButton*)saveSimulationButton)->SetSplitActionCallback(new SaveSimulationAction(this));
AddComponent(saveSimulationButton);
saveSimulationButton->SetIcon(IconSave);
currentX+=151;
((SplitButton*)saveSimulationButton)->SetSplitActionCallback(new SaveSimulationAction(this));
AddComponent(saveSimulationButton);
class UpVoteAction : public ui::ButtonAction
{
GameView * v;
public:
UpVoteAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->Vote(1);
}
};
upVoteButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(15, 15), "", "Like this save");
upVoteButton->SetIcon(IconVoteUp);
upVoteButton->Appearance.Margin.Top+=2;
upVoteButton->Appearance.Margin.Left+=2;
currentX+=14;
upVoteButton->SetActionCallback(new UpVoteAction(this));
AddComponent(upVoteButton);
class UpVoteAction : public ui::ButtonAction
{
GameView * v;
public:
UpVoteAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->Vote(1);
}
};
upVoteButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(15, 15), "", "Like this save");
upVoteButton->SetIcon(IconVoteUp);
upVoteButton->Appearance.Margin.Top+=2;
upVoteButton->Appearance.Margin.Left+=2;
currentX+=14;
upVoteButton->SetActionCallback(new UpVoteAction(this));
AddComponent(upVoteButton);
class DownVoteAction : public ui::ButtonAction
{
GameView * v;
public:
DownVoteAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->Vote(-1);
}
};
downVoteButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(15, 15), "", "Dislike this save");
downVoteButton->SetIcon(IconVoteDown);
downVoteButton->Appearance.Margin.Bottom+=2;
downVoteButton->Appearance.Margin.Left+=2;
currentX+=16;
downVoteButton->SetActionCallback(new DownVoteAction(this));
AddComponent(downVoteButton);
class DownVoteAction : public ui::ButtonAction
{
GameView * v;
public:
DownVoteAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->Vote(-1);
}
};
downVoteButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(15, 15), "", "Dislike this save");
downVoteButton->SetIcon(IconVoteDown);
downVoteButton->Appearance.Margin.Bottom+=2;
downVoteButton->Appearance.Margin.Left+=2;
currentX+=16;
downVoteButton->SetActionCallback(new DownVoteAction(this));
AddComponent(downVoteButton);
class TagSimulationAction : public ui::ButtonAction
{
GameView * v;
public:
TagSimulationAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenTags();
}
};
tagSimulationButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(251, 15), "[no tags set]", "Add simulation tags");
class TagSimulationAction : public ui::ButtonAction
{
GameView * v;
public:
TagSimulationAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenTags();
}
};
tagSimulationButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(251, 15), "[no tags set]", "Add simulation tags");
tagSimulationButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
tagSimulationButton->SetIcon(IconTag);
currentX+=252;
tagSimulationButton->SetActionCallback(new TagSimulationAction(this));
AddComponent(tagSimulationButton);
tagSimulationButton->SetIcon(IconTag);
currentX+=252;
tagSimulationButton->SetActionCallback(new TagSimulationAction(this));
AddComponent(tagSimulationButton);
class ClearSimAction : public ui::ButtonAction
{
GameView * v;
public:
ClearSimAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->ClearSim();
}
};
clearSimButton = new ui::Button(ui::Point(Size.X-159, Size.Y-16), ui::Point(17, 15), "", "Erase everything");
clearSimButton->SetIcon(IconNew);
clearSimButton->Appearance.Margin.Left+=2;
clearSimButton->SetActionCallback(new ClearSimAction(this));
AddComponent(clearSimButton);
class ClearSimAction : public ui::ButtonAction
{
GameView * v;
public:
ClearSimAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->ClearSim();
}
};
clearSimButton = new ui::Button(ui::Point(Size.X-159, Size.Y-16), ui::Point(17, 15), "", "Erase everything");
clearSimButton->SetIcon(IconNew);
clearSimButton->Appearance.Margin.Left+=2;
clearSimButton->SetActionCallback(new ClearSimAction(this));
AddComponent(clearSimButton);
class LoginAction : public ui::ButtonAction
{
GameView * v;
public:
LoginAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenLogin();
}
};
loginButton = new ui::Button(ui::Point(Size.X-141, Size.Y-16), ui::Point(92, 15), "[sign in]", "Sign into simulation server");
class LoginAction : public ui::ButtonAction
{
GameView * v;
public:
LoginAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenLogin();
}
};
loginButton = new ui::Button(ui::Point(Size.X-141, Size.Y-16), ui::Point(92, 15), "[sign in]", "Sign into simulation server");
loginButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
loginButton->SetIcon(IconLogin);
loginButton->SetActionCallback(new LoginAction(this));
AddComponent(loginButton);
loginButton->SetIcon(IconLogin);
loginButton->SetActionCallback(new LoginAction(this));
AddComponent(loginButton);
class SimulationOptionAction : public ui::ButtonAction
{
GameView * v;
public:
SimulationOptionAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenOptions();
}
};
simulationOptionButton = new ui::Button(ui::Point(Size.X-48, Size.Y-16), ui::Point(15, 15), "", "Simulation options");
simulationOptionButton->SetIcon(IconSimulationSettings);
simulationOptionButton->Appearance.Margin.Left+=2;
simulationOptionButton->SetActionCallback(new SimulationOptionAction(this));
AddComponent(simulationOptionButton);
class SimulationOptionAction : public ui::ButtonAction
{
GameView * v;
public:
SimulationOptionAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenOptions();
}
};
simulationOptionButton = new ui::Button(ui::Point(Size.X-48, Size.Y-16), ui::Point(15, 15), "", "Simulation options");
simulationOptionButton->SetIcon(IconSimulationSettings);
simulationOptionButton->Appearance.Margin.Left+=2;
simulationOptionButton->SetActionCallback(new SimulationOptionAction(this));
AddComponent(simulationOptionButton);
class DisplayModeAction : public ui::ButtonAction
{
GameView * v;
public:
DisplayModeAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenRenderOptions();
}
};
displayModeButton = new ui::Button(ui::Point(Size.X-32, Size.Y-16), ui::Point(15, 15), "", "Renderer options");
displayModeButton->SetIcon(IconRenderSettings);
displayModeButton->Appearance.Margin.Left+=2;
displayModeButton->SetActionCallback(new DisplayModeAction(this));
AddComponent(displayModeButton);
class DisplayModeAction : public ui::ButtonAction
{
GameView * v;
public:
DisplayModeAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
v->c->OpenRenderOptions();
}
};
displayModeButton = new ui::Button(ui::Point(Size.X-32, Size.Y-16), ui::Point(15, 15), "", "Renderer options");
displayModeButton->SetIcon(IconRenderSettings);
displayModeButton->Appearance.Margin.Left+=2;
displayModeButton->SetActionCallback(new DisplayModeAction(this));
AddComponent(displayModeButton);
class PauseAction : public ui::ButtonAction
{
@@ -1609,33 +1609,33 @@ void GameView::DoDraw()
void GameView::NotifyNotificationsChanged(GameModel * sender)
{
class NotificationButtonAction : public ui::ButtonAction
{
GameView * v;
Notification * notification;
public:
NotificationButtonAction(GameView * v, Notification * notification) : v(v), notification(notification) { }
void ActionCallback(ui::Button * sender)
{
notification->Action();
//v->c->RemoveNotification(notification);
}
};
class CloseNotificationButtonAction : public ui::ButtonAction
{
GameView * v;
Notification * notification;
public:
CloseNotificationButtonAction(GameView * v, Notification * notification) : v(v), notification(notification) { }
void ActionCallback(ui::Button * sender)
{
v->c->RemoveNotification(notification);
}
class NotificationButtonAction : public ui::ButtonAction
{
GameView * v;
Notification * notification;
public:
NotificationButtonAction(GameView * v, Notification * notification) : v(v), notification(notification) { }
void ActionCallback(ui::Button * sender)
{
notification->Action();
//v->c->RemoveNotification(notification);
}
};
class CloseNotificationButtonAction : public ui::ButtonAction
{
GameView * v;
Notification * notification;
public:
CloseNotificationButtonAction(GameView * v, Notification * notification) : v(v), notification(notification) { }
void ActionCallback(ui::Button * sender)
{
v->c->RemoveNotification(notification);
}
void AltActionCallback(ui::Button * sender)
{
v->c->RemoveNotification(notification);
}
};
{
v->c->RemoveNotification(notification);
}
};
for(std::vector<ui::Component*>::const_iterator iter = notificationComponents.begin(), end = notificationComponents.end(); iter != end; ++iter) {
ui::Component * cNotification = *iter;
@@ -1942,7 +1942,7 @@ void GameView::OnDraw()
{
string message = (*iter);
startY -= 13;
g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6 , 14, 0, 0, 0, 100);
g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6 , 14, 0, 0, 0, 100);
g->drawtext(startX, startY, message.c_str(), 255, 255, 255, startAlpha);
startAlpha-=14;
}

View File

@@ -53,6 +53,7 @@ SearchView::SearchView():
};
sortButton = new ui::Button(ui::Point(XRES+BARSIZE-140, 10), ui::Point(61, 17), "Sort");
sortButton->SetIcon(IconVoteSort);
sortButton->SetTogglable(true);
sortButton->SetActionCallback(new SortAction(this));
sortButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
sortButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
@@ -274,54 +275,56 @@ void SearchView::NotifySortChanged(SearchModel * sender)
{
if(sender->GetSort() == "best")
{
sortButton->SetText("By votes");
sortButton->SetIcon(IconVoteSort);
sortButton->SetToggleState(false);
sortButton->SetText("By votes");
sortButton->SetIcon(IconVoteSort);
}
else
else
{
sortButton->SetText("By date");
sortButton->SetToggleState(true);
sortButton->SetText("By date");
sortButton->SetIcon(IconDateSort);
}
}
void SearchView::NotifyShowOwnChanged(SearchModel * sender)
{
ownButton->SetToggleState(sender->GetShowOwn());
if(sender->GetShowOwn() || Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
{
unpublishSelected->Enabled = true;
removeSelected->Enabled = true;
}
else if(sender->GetShowFavourite())
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
else
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
ownButton->SetToggleState(sender->GetShowOwn());
if(sender->GetShowOwn() || Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
{
unpublishSelected->Enabled = true;
removeSelected->Enabled = true;
}
else if(sender->GetShowFavourite())
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
else
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
}
void SearchView::NotifyShowFavouriteChanged(SearchModel * sender)
{
favButton->SetToggleState(sender->GetShowFavourite());
if(sender->GetShowFavourite())
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
else if(sender->GetShowOwn() || Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
{
unpublishSelected->Enabled = true;
removeSelected->Enabled = true;
}
else
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
favButton->SetToggleState(sender->GetShowFavourite());
if(sender->GetShowFavourite())
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
else if(sender->GetShowOwn() || Client::Ref().GetAuthUser().UserElevation == User::ElevationAdmin || Client::Ref().GetAuthUser().UserElevation == User::ElevationModerator)
{
unpublishSelected->Enabled = true;
removeSelected->Enabled = true;
}
else
{
unpublishSelected->Enabled = false;
removeSelected->Enabled = false;
}
}
void SearchView::NotifyPageChanged(SearchModel * sender)