improve dialog and cloud browse icon text, deselect guide on mode leave

This commit is contained in:
2019-07-10 21:49:01 +02:00
parent 48c39c4ef2
commit 327eb4678b
5 changed files with 18 additions and 14 deletions

View File

@@ -918,10 +918,10 @@
<!-- DIALOG BROWSE --> <!-- DIALOG BROWSE -->
<layout id="dialog-browse-item"> <layout id="dialog-browse-item">
<border dir="col" color=".4 .4 .4 .8" pad="4" height="120" width="100" margin="1 1 1 1" grow="1" align="center"> <border dir="col" color=".4 .4 .4 .8" pad="4" height="100" width="100" margin="1 1 1 1" grow="1" align="center">
<image-texture id="thumb-tex" width="100%" grow="1" height="1" aspect-ratio="1"> <image-texture id="thumb-tex" width="100%" grow="1" height="1" aspect-ratio="1">
<border positioning="absolute" color="0 0 0 .5" pad="2"> <border positioning="absolute" color="0 0 0 .5" pad="2" width="100%">
<text id="title" text="File Name" margin="5 0 0 0" text-wrap-width="90"/> <text id="title" text="File Name" text-wrap-width="85"/>
</border> </border>
</image-texture> </image-texture>
</border> </border>
@@ -951,9 +951,12 @@
<!-- DIALOG CLOUD BROWSE --> <!-- DIALOG CLOUD BROWSE -->
<layout id="dialog-cloud-item"> <layout id="dialog-cloud-item">
<border dir="col" color=".4 .4 .4 .8" pad="4" height="120" width="100" margin="1 1 1 1" grow="1" align="center"> <border dir="col" color=".4 .4 .4 .8" pad="4" height="100" width="100" margin="1 1 1 1" grow="1" align="center">
<image-texture id="thumb-tex" width="100%" grow="1" height="1" aspect-ratio="1"/> <image-texture id="thumb-tex" width="100%" grow="1" height="1" aspect-ratio="1">
<text id="title" text="File Name" margin="5 0 0 0"/> <border positioning="absolute" color="0 0 0 .5" pad="2" width="100%">
<text id="title" text="File Name" text-wrap-width="85"/>
</border>
</image-texture>
</border> </border>
</layout> </layout>
<layout id="dialog-cloud"> <layout id="dialog-cloud">

View File

@@ -345,7 +345,6 @@ public:
template<typename T, typename R = std::result_of<T()>::type> template<typename T, typename R = std::result_of<T()>::type>
std::future<R> ui_task_async(T task) std::future<R> ui_task_async(T task)
{ {
#ifdef _WIN32
std::packaged_task<R()> pt(task); std::packaged_task<R()> pt(task);
std::future<R> f = pt.get_future(); std::future<R> f = pt.get_future();
if (is_ui_thread()) if (is_ui_thread())
@@ -361,13 +360,11 @@ public:
ui_cv.notify_all(); ui_cv.notify_all();
} }
return f; return f;
#endif // _WIN32
} }
template<typename T, typename R = std::result_of<T()>::type> template<typename T, typename R = std::result_of<T()>::type>
R ui_task(T task) R ui_task(T task)
{ {
#ifdef _WIN32
std::packaged_task<R()> pt(task); std::packaged_task<R()> pt(task);
std::future<R> f = pt.get_future(); std::future<R> f = pt.get_future();
if (is_ui_thread()) if (is_ui_thread())
@@ -383,7 +380,6 @@ public:
ui_cv.notify_all(); ui_cv.notify_all();
} }
return ui_running ? f.get() : R(); return ui_running ? f.get() : R();
#endif // _WIN32
} }
void ui_sync() void ui_sync()

View File

@@ -3136,15 +3136,14 @@ Layer::Snapshot Layer::snapshot(std::array<glm::vec4, 6> * dirty_box /*= nullptr
snap.image[i] = std::make_unique<uint8_t[]>(m_rtt[i].bytes()); snap.image[i] = std::make_unique<uint8_t[]>(m_rtt[i].bytes());
//glReadBuffer(GL_BACK);
App::I.render_task_async([this,i,&snap] App::I.render_task_async([this,i,&snap]
{ {
m_rtt[i].bindFramebuffer(); m_rtt[i].bindFramebuffer();
glm::vec2 box_sz = zw(snap.m_dirty_box[i]) - xy(snap.m_dirty_box[i]); glm::vec2 box_sz = zw(snap.m_dirty_box[i]) - xy(snap.m_dirty_box[i]);
glReadPixels(snap.m_dirty_box[i].x, snap.m_dirty_box[i].y, box_sz.x, box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, snap.image[i].get()); glReadPixels(snap.m_dirty_box[i].x, snap.m_dirty_box[i].y,
box_sz.x, box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, snap.image[i].get());
m_rtt[i].unbindFramebuffer(); m_rtt[i].unbindFramebuffer();
}); });
//glReadBuffer(GL_NONE);
} }
App::I.render_sync(); App::I.render_sync();
return snap; return snap;

View File

@@ -565,6 +565,11 @@ void CanvasModeGrid::clear()
m_lines.clear(); m_lines.clear();
} }
void CanvasModeGrid::leave(kCanvasMode next)
{
m_selected_index = -1;
}
void CanvasModeGrid::on_KeyEvent(KeyEvent* ke) void CanvasModeGrid::on_KeyEvent(KeyEvent* ke)
{ {
if ((ke->m_key == kKey::KeyBackspace || ke->m_key == kKey::KeyDel) if ((ke->m_key == kKey::KeyBackspace || ke->m_key == kKey::KeyDel)

View File

@@ -137,12 +137,13 @@ class CanvasModeGrid : public CanvasMode
std::unique_ptr<class ActionModeGrid> m_action; std::unique_ptr<class ActionModeGrid> m_action;
public: public:
bool m_highlight = false; bool m_highlight = false;
int m_selected_index; int m_selected_index = -1;
std::vector<ray_t> m_lines; std::vector<ray_t> m_lines;
virtual void on_MouseEvent(MouseEvent* me, glm::vec2& loc) override; virtual void on_MouseEvent(MouseEvent* me, glm::vec2& loc) override;
virtual void on_KeyEvent(KeyEvent* ke) override; virtual void on_KeyEvent(KeyEvent* ke) override;
virtual void on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera) override; virtual void on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera) override;
virtual void init() override; virtual void init() override;
virtual void leave(kCanvasMode next) override;
void commit(); void commit();
void clear(); void clear();
}; };