Reverted resource references for combine_something, you can't use tool_image here, because on MSW that only works for .bmps'

Added dependency stuff to invalidate Choice images;
Fixed 'duplicate' in symbol editor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@197 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-02-07 16:17:15 +00:00
parent 504269e903
commit b93e5b2ae3
19 changed files with 109 additions and 33 deletions
+6 -6
View File
@@ -20,12 +20,12 @@ SymbolPartList::SymbolPartList(Window* parent, int id, SymbolP symbol)
// Create image list
wxImageList* images = new wxImageList(16,16);
// NOTE: this is based on the order of the SymbolPartCombine enum!
images->Add(load_resource_tool_image(_("combine_or")));
images->Add(load_resource_tool_image(_("combine_sub")));
images->Add(load_resource_tool_image(_("combine_and")));
images->Add(load_resource_tool_image(_("combine_xor")));
images->Add(load_resource_tool_image(_("combine_over")));
images->Add(load_resource_tool_image(_("combine_border")));
images->Add(load_resource_image(_("combine_or")));
images->Add(load_resource_image(_("combine_sub")));
images->Add(load_resource_image(_("combine_and")));
images->Add(load_resource_image(_("combine_xor")));
images->Add(load_resource_image(_("combine_over")));
images->Add(load_resource_image(_("combine_border")));
AssignImageList(images, wxIMAGE_LIST_SMALL);
// create columns
InsertColumn(0, _("Name"));
+5 -5
View File
@@ -107,12 +107,12 @@ void SymbolSelectEditor::drawRotationCenter(DC& dc, const Vector2D& pos) {
void SymbolSelectEditor::initUI(wxToolBar* tb, wxMenuBar* mb) {
tb->AddSeparator();
tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_tool_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it"));
tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_tool_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape"));
tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_tool_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes"));
tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it"));
tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape"));
tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes"));
// note: difference doesn't work (yet)
tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_tool_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it"));
tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_tool_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border"));
tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it"));
tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border"));
tb->Realize();
}
void SymbolSelectEditor::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
+2
View File
@@ -46,6 +46,8 @@ wxCursor load_resource_cursor(const String& name);
wxIcon load_resource_icon(const String& name);
/// Load an image for use in a toolbar (filename: tool/...) from a resource
/** Note: should ONLY be used for ".bmp" images for now
*/
wxBitmap load_resource_tool_image(const String& name);
// ----------------------------------------------------------------------------- : Platform look
+8 -5
View File
@@ -19,7 +19,7 @@ DECLARE_TYPEOF_COLLECTION(ChoiceField::ChoiceP);
class ChoiceThumbnailRequest : public ThumbnailRequest {
public:
ChoiceThumbnailRequest(ChoiceValueEditor* cve, int id);
ChoiceThumbnailRequest(ChoiceValueEditor* cve, int id, bool from_disk);
virtual Image generate();
virtual void store(const Image&);
private:
@@ -27,11 +27,13 @@ class ChoiceThumbnailRequest : public ThumbnailRequest {
int id;
};
ChoiceThumbnailRequest::ChoiceThumbnailRequest(ChoiceValueEditor* cve, int id)
ChoiceThumbnailRequest::ChoiceThumbnailRequest(ChoiceValueEditor* cve, int id, bool from_disk)
: ThumbnailRequest(
cve,
cve->viewer.stylesheet->name() + _("/") + cve->field().name + _("/") << id,
cve->viewer.stylesheet->lastModified())
from_disk ? cve->viewer.stylesheet->lastModified()
: wxDateTime::Now()
)
, stylesheet(cve->viewer.stylesheet)
, id(id)
{}
@@ -195,10 +197,11 @@ void DropDownChoiceList::generateThumbnailImages() {
for (int i = 0 ; i < end ; ++i) {
String name = cannocial_name_form(group->choiceName(i));
ScriptableImage& img = cve.style().choice_images[name];
if (i >= image_count || !img.upToDate(ctx, cve.style().thumbnail_age)) {
bool up_to_date = img.upToDate(ctx, cve.style().thumbnail_age);
if (i >= image_count || !up_to_date) {
// TODO : handle the case where image i was previously skipped
// request this thumbnail
thumbnail_thread.request( new_shared2<ChoiceThumbnailRequest>(&cve, i) );
thumbnail_thread.request( new_shared3<ChoiceThumbnailRequest>(&cve, i, up_to_date && !cve.style().invalidated_images) );
}
}
cve.style().thumbnail_age.update();
+2
View File
@@ -78,6 +78,7 @@ void WelcomeWindow::draw(DC& dc) {
void WelcomeWindow::onOpenSet(wxCommandEvent&) {
wxFileDialog dlg(this, _TITLE_("open set"), wxEmptyString, wxEmptyString, import_formats(), wxOPEN);
if (dlg.ShowModal() == wxID_OK) {
wxBusyCursor wait;
close(import_set(dlg.GetPath()));
}
}
@@ -95,6 +96,7 @@ shared_ptr<T> open_package(const String& filename) {
}
void WelcomeWindow::onOpenLast(wxCommandEvent&) {
wxBusyCursor wait;
assert(!settings.recent_sets.empty());
close( open_package<Set>(settings.recent_sets.front()) );
}