Skip to content

Commit

Permalink
make ToolTips in LibaryPane more meaningful, display on-disk paths
Browse files Browse the repository at this point in the history
  • Loading branch information
meikelm committed Jun 29, 2024
1 parent 1a93303 commit 311eaa1
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/WEDCore/README.WorldEditor
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ menu to view it online.
CHANGE HISTORY

WED 2.6.0b3
- minor accuracy improvement in map projection for very large objetcs
Features:
- force default dir for most file open dialogs to be current scenery pack
- make ToolTips in LibraryList more meaningful
Bug fix:
- minor accuracy improvement in map projection for very large objetcs
- fix duplicated exclusion zones at full scenery import
- WED-1507 fix exclusion polygons still green when locked

Expand Down
5 changes: 4 additions & 1 deletion src/WEDLibrary/WED_LibraryListAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class WED_MapPane;
class WED_LibraryPreviewPane;

class WED_LibraryListAdapter : public GUI_TextTableProvider, public GUI_SimpleTableGeometry, public GUI_TextTableHeaderProvider, public GUI_Broadcaster, public GUI_Listener {

friend class WED_LibraryTextTable;

public:
WED_LibraryListAdapter(WED_LibraryMgr * who);
virtual ~WED_LibraryListAdapter();
Expand Down Expand Up @@ -158,7 +161,7 @@ class WED_LibraryListAdapter : public GUI_TextTableProvider, public GUI_SimpleTa
GUI_Broadcaster * inSrc,
intptr_t inMsg,
intptr_t inParam);

private:
/* What is a prefix and how do I use it? A guide about how to use
* mCache and mOpen with all their related methods with the new prefix system.
Expand Down
37 changes: 37 additions & 0 deletions src/WEDLibrary/WED_LibraryPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,43 @@ WED_LibraryPane::~WED_LibraryPane()
{
}

int WED_LibraryTextTable::CellGetHelpTip(int cell_bounds[4], int cell_x, int cell_y, int mouse_x, int mouse_y, string& tip)
{
if (cell_x == 0)
{
auto path = mAdap->GetNthCacheIndex(cell_y, true);
if (mAdap->mLibrary->GetResourceType(path) >= res_Object)
{
if (mAdap->mLibrary->IsResourceLocal(path))
tip = path;
else
{
tip = mAdap->mLibrary->GetResourcePath(path);
int i = tip.rfind("default scenery");
if (i > 0)
i += sizeof("default scenery");
else
i = tip.rfind("Custom Scenery") + sizeof("Custom Scenery");
tip.erase(0, i);
}
return 1;
}
}
else
{
tip.clear();
if (mAdap->mCache[cell_y].hasSeasons) tip = ",seaonally";
if (mAdap->mCache[cell_y].hasRegions) tip += ",regionally";
if (mAdap->mCache[cell_y].variants) tip += ",randomly";
if (tip.length() > 0)
{
tip = string("Varies ") + tip.substr(1);
return 1;
}
}
return 0;
}

int WED_LibraryPane::MouseMove(int x, int y)
{
int b[4];
Expand Down
19 changes: 18 additions & 1 deletion src/WEDLibrary/WED_LibraryPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ class GUI_ScrollerPane;
class WED_LibraryMgr;
class WED_LibraryFilterBar;

class WED_LibraryTextTable : public GUI_TextTable {
public:
WED_LibraryTextTable(GUI_Commander* parent, int indent, int live_edit)
: GUI_TextTable(parent, indent, live_edit) {};
virtual ~WED_LibraryTextTable() {};

void SetProvider(WED_LibraryListAdapter* adap)
{
mAdap = adap;
GUI_TextTable::SetProvider(adap);
}
virtual int CellGetHelpTip(int cell_bounds[4], int cell_x, int cell_y, int mouse_x, int mouse_y, string& tip);

private:
WED_LibraryListAdapter* mAdap;
};

class WED_LibraryPane : public GUI_Packer, public GUI_Commander, public GUI_Listener {
public:

Expand All @@ -57,7 +74,7 @@ class WED_LibraryPane : public GUI_Packer, public GUI_Commander, public GUI_List
GUI_Table * mTable;
GUI_Header * mHeader;

GUI_TextTable mTextTable;
WED_LibraryTextTable mTextTable;

WED_LibraryFilterBar * mFilter;
WED_LibraryListAdapter mLibraryList;
Expand Down
1 change: 0 additions & 1 deletion src/WEDLibrary/WED_LibraryPreviewPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class WED_LibraryPreviewPane : public GUI_Pane, public GUI_Listener, public GUI_

private:
void DrawOneItem(int type, const string& res, int b[4], GUI_GraphState * g, const char * label = nullptr);
void UpdateFacadePreview(void);
void begin3d(const int *b, double radius_m);
void end3d(const int *b);

Expand Down

0 comments on commit 311eaa1

Please sign in to comment.