[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Windstille-devel] rev 359 - trunk/src
From: |
Ingo Ruhnke |
Subject: |
[Windstille-devel] rev 359 - trunk/src |
Date: |
Sat, 29 May 2004 01:21:45 +0200 |
Author: grumbel
Date: 2004-05-29 01:21:45 +0200 (Sat, 29 May 2004)
New Revision: 359
Modified:
trunk/src/editor.py
trunk/src/editor_map.cxx
trunk/src/editor_map.hxx
trunk/src/flexlay.i
trunk/src/icon.cxx
trunk/src/icon.hxx
trunk/src/simpleed.cxx
trunk/src/workspace.cxx
trunk/src/workspace.hxx
Log:
- added disable/enable for icons
- add sigchange for maps undo stack
Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/editor.py 2004-05-28 23:21:45 UTC (rev 359)
@@ -105,6 +105,22 @@
undo_icon.set_callback(m.undo)
redo_icon.set_callback(m.redo)
+undo_icon.disable()
+redo_icon.disable()
+
+def on_map_change():
+ if (m.undo_stack_size() > 0):
+ undo_icon.enable()
+ else:
+ undo_icon.disable()
+
+ if (m.redo_stack_size() > 0):
+ redo_icon.enable()
+ else:
+ redo_icon.disable()
+
+connect(m.sig_change(), on_map_change)
+
toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 256)),
gui.get_component())
select = Icon(CL_Point(2, 32*0+2),
make_sprite("../data/images/tools/stock-tool-rect-select-22.png"), "Some
tooltip", toolbar);
Modified: trunk/src/editor_map.cxx
===================================================================
--- trunk/src/editor_map.cxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/editor_map.cxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -49,6 +49,9 @@
Commands undo_stack;
Commands redo_stack;
+
+ CL_Signal_v0 on_change;
+
};
EditorMap::EditorMap()
@@ -161,7 +164,7 @@
void
EditorMap::set_background_color(const CL_Color& color)
{
- impl-> background_color = color;
+ impl-> background_color = color;
}
void
@@ -170,6 +173,7 @@
impl->redo_stack.clear();
command.execute();
impl->undo_stack.push_back(command);
+ impl->on_change();
}
void
@@ -181,6 +185,7 @@
impl->undo_stack.pop_back();
command.undo();
impl->redo_stack.push_back(command);
+ impl->on_change();
}
}
@@ -193,7 +198,26 @@
impl->redo_stack.pop_back();
command.redo();
impl->undo_stack.push_back(command);
+ impl->on_change();
}
}
+int
+EditorMap::undo_stack_size()
+{
+ return impl->undo_stack.size();
+}
+
+int
+EditorMap::redo_stack_size()
+{
+ return impl->redo_stack.size();
+}
+
+CL_Signal_v0&
+EditorMap::sig_change()
+{
+ return impl->on_change;
+}
+
/* EOF */
Modified: trunk/src/editor_map.hxx
===================================================================
--- trunk/src/editor_map.hxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/editor_map.hxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -72,6 +72,12 @@
/** Move forward in the undo stack */
void redo();
+
+ int undo_stack_size();
+
+ int redo_stack_size();
+
+ CL_Signal_v0& sig_change();
private:
CL_SharedPtr<EditorMapImpl> impl;
};
Modified: trunk/src/flexlay.i
===================================================================
--- trunk/src/flexlay.i 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/flexlay.i 2004-05-28 23:21:45 UTC (rev 359)
@@ -81,6 +81,5 @@
%include "menu.hxx"
%include "menubar.hxx"
%include "scrollbar.hxx"
-
/* EOF */
Modified: trunk/src/icon.cxx
===================================================================
--- trunk/src/icon.cxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/icon.cxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -36,6 +36,7 @@
std::string tooltip;
bool draw_tooltip;
bool down;
+ bool is_enabled;
CL_Signal_v0 sig_on_click;
void draw();
@@ -54,6 +55,7 @@
impl->tooltip = tooltip;
impl->draw_tooltip = true;
impl->down = false;
+ impl->is_enabled = true;
impl->slots.push_back(sig_paint().connect(impl.get(), &IconImpl::draw));
impl->slots.push_back(sig_mouse_down().connect(impl.get(),
&IconImpl::mouse_down));
@@ -69,6 +71,7 @@
impl->tooltip = tooltip;
impl->draw_tooltip = true;
impl->down = false;
+ impl->is_enabled = true;
impl->slots.push_back(sig_paint().connect(impl.get(), &IconImpl::draw));
impl->slots.push_back(sig_mouse_down().connect(impl.get(),
&IconImpl::mouse_down));
@@ -86,43 +89,71 @@
{
CL_Rect rect(CL_Point(0, 0), CL_Size(parent->get_width()-4,
parent->get_height()-4));
- if (parent->has_mouse_over())
+ sprite.set_alignment(origin_center);
+
+ if (is_enabled)
{
- if (down)
- Box::draw_button_down(rect);
+ if (parent->has_mouse_over())
+ {
+ if (down)
+ Box::draw_button_down(rect);
+ else
+ Box::draw_button_up(rect);
+ }
else
- Box::draw_button_up(rect);
+ Box::draw_button_neutral(rect);
+
+ sprite.set_alpha(1.0f);
}
else
- Box::draw_button_neutral(rect);
-
- sprite.set_alignment(origin_center);
+ {
+ Box::draw_button_neutral(rect);
+ sprite.set_alpha(0.3f);
+ }
sprite.draw((rect.get_width()+1)/2, (rect.get_height()+1)/2);
}
void
IconImpl::mouse_up (const CL_InputEvent& event)
{
- down = false;
- parent->release_mouse();
+ if (is_enabled)
+ {
+ down = false;
+ parent->release_mouse();
- if (parent->has_mouse_over())
- {
- sig_on_click();
+ if (parent->has_mouse_over())
+ {
+ sig_on_click();
+ }
}
}
void
IconImpl::mouse_down(const CL_InputEvent& event)
{
- down = true;
- parent->capture_mouse();
+ if (is_enabled)
+ {
+ down = true;
+ parent->capture_mouse();
+ }
}
void
IconImpl::mouse_move(const CL_InputEvent& event)
{
- std::cout << "icon: mouse_move: " << event << std::endl;
+ //std::cout << "icon: mouse_move: " << event << std::endl;
}
+void
+Icon::disable()
+{
+ impl->is_enabled = false;
+}
+
+void
+Icon::enable()
+{
+ impl->is_enabled = true;
+}
+
/* EOF */
Modified: trunk/src/icon.hxx
===================================================================
--- trunk/src/icon.hxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/icon.hxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -34,6 +34,9 @@
public:
Icon(const CL_Point& pos, const CL_Sprite& sprite, const std::string&
tooltip, CL_Component* parent);
Icon(const CL_Rect& rect, const CL_Sprite& sprite, const std::string&
tooltip, CL_Component* parent);
+
+ void disable();
+ void enable();
CL_Signal_v0& sig_clicked();
Modified: trunk/src/simpleed.cxx
===================================================================
--- trunk/src/simpleed.cxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/simpleed.cxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -29,6 +29,7 @@
#include "layer.hxx"
#include "tilemap_layer.hxx"
#include "flexlay.hxx"
+#include "editor_map.hxx"
int main()
{
Modified: trunk/src/workspace.cxx
===================================================================
--- trunk/src/workspace.cxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/workspace.cxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -147,7 +147,7 @@
}
void
-Workspace::set_map(EditorMap m)
+Workspace::set_map(const EditorMap& m)
{
impl->editor_map = m;
}
Modified: trunk/src/workspace.hxx
===================================================================
--- trunk/src/workspace.hxx 2004-05-28 22:55:42 UTC (rev 358)
+++ trunk/src/workspace.hxx 2004-05-28 23:21:45 UTC (rev 359)
@@ -23,9 +23,9 @@
#include <ClanLib/Core/System/sharedptr.h>
#include <ClanLib/Display/input_event.h>
#include "graphic_context_state.hxx"
-#include "editor_map.hxx"
class WorkspaceImpl;
+class EditorMap;
/** */
class Workspace
@@ -46,7 +46,7 @@
void mouse_move(const CL_InputEvent& event);
EditorMap get_map();
- void set_map(EditorMap m);
+ void set_map(const EditorMap& m);
GraphicContextState& get_gc_state();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Windstille-devel] rev 359 - trunk/src,
Ingo Ruhnke <=