mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 03:39:57 +01:00
Improved appearance Display view
Enhance difference between selected / unselected window
This commit is contained in:
@@ -106,20 +106,11 @@ DisplaysView::DisplaysView() : View(DISPLAYS)
|
||||
w->root_->attach(w->overlays_);
|
||||
// overlays_ [0] is for not active frame
|
||||
Frame *frame = new Frame(Frame::SHARP, Frame::THIN, Frame::DROP);
|
||||
frame->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
frame->color = glm::vec4( COLOR_WINDOW, 0.5f );
|
||||
w->overlays_->attach(frame);
|
||||
// overlays_ [1] is for active frame
|
||||
Group *g = new Group;
|
||||
w->overlays_->attach(g);
|
||||
// Output frame
|
||||
w->output_frame_ = new Group;
|
||||
w->output_frame_->visible_ = false;
|
||||
frame = new Frame(Frame::SHARP, Frame::THIN, Frame::NONE);
|
||||
frame->color = glm::vec4( COLOR_FRAME, 1.f );
|
||||
w->output_frame_->attach(frame);
|
||||
w->output_handles_ = new Handles(Handles::RESIZE);
|
||||
w->output_handles_->color = glm::vec4( COLOR_FRAME, 1.f );
|
||||
w->output_frame_->attach(w->output_handles_);
|
||||
// Overlay menu icon
|
||||
w->menu_ = new Handles(Handles::MENU);
|
||||
w->menu_->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
@@ -128,7 +119,6 @@ DisplaysView::DisplaysView() : View(DISPLAYS)
|
||||
frame = new Frame(Frame::SHARP, Frame::LARGE, Frame::NONE);
|
||||
frame->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
g->attach(frame);
|
||||
g->attach(w->output_frame_);
|
||||
// Overlay has two modes : window or fullscreen
|
||||
w->mode_ = new Switch;
|
||||
g->attach(w->mode_);
|
||||
@@ -141,13 +131,17 @@ DisplaysView::DisplaysView() : View(DISPLAYS)
|
||||
w->fullscreen_->scale_ = glm::vec3(2.f, 2.f, 1.f);
|
||||
w->fullscreen_->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
w->mode_->attach(w->fullscreen_);
|
||||
// // title bar
|
||||
// w->title_ = new Surface (new Shader);
|
||||
// w->title_->shader()->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
// w->title_->scale_ = glm::vec3(1.002f, WINDOW_TITLEBAR_HEIGHT, 1.f);
|
||||
// w->title_->translation_ = glm::vec3(0.f, 1.f + WINDOW_TITLEBAR_HEIGHT, 0.f);
|
||||
// w->root_->attach(w->title_);
|
||||
// Output frame
|
||||
w->output_group_ = new Group;
|
||||
w->root_->attach(w->output_group_);
|
||||
w->output_frame_ = new Frame(Frame::SHARP, Frame::THIN, Frame::NONE);
|
||||
w->output_frame_->color = glm::vec4( COLOR_FRAME, 1.f );
|
||||
w->output_group_->attach(w->output_frame_);
|
||||
w->output_handles_ = new Handles(Handles::RESIZE);
|
||||
w->output_handles_->color = glm::vec4( COLOR_FRAME, 1.f );
|
||||
w->output_group_->attach(w->output_handles_);
|
||||
// default to not active & window overlay frame
|
||||
w->output_group_->visible_ = false;
|
||||
w->overlays_->setActive(0);
|
||||
w->mode_->setActive(0);
|
||||
}
|
||||
@@ -178,10 +172,10 @@ void DisplaysView::update(float dt)
|
||||
|
||||
// Rendering of output is scaled to content and manipulated by output frame
|
||||
if (Settings::application.windows[i+1].scaled) {
|
||||
windows_[i].output_render_->scale_ = windows_[i].output_frame_->scale_;
|
||||
windows_[i].output_render_->translation_ = windows_[i].output_frame_->translation_;
|
||||
windows_[i].output_render_->scale_ = windows_[i].output_group_->scale_;
|
||||
windows_[i].output_render_->translation_ = windows_[i].output_group_->translation_;
|
||||
// show output frame
|
||||
windows_[i].output_frame_->visible_ = true;
|
||||
windows_[i].output_group_->visible_ = true;
|
||||
}
|
||||
// Rendering of output is adjusted to match aspect ratio of framebuffer
|
||||
else {
|
||||
@@ -193,7 +187,7 @@ void DisplaysView::update(float dt)
|
||||
// reset translation
|
||||
windows_[i].output_render_->translation_ = glm::vec3(0.f);
|
||||
// do not show output frame
|
||||
windows_[i].output_frame_->visible_ = false;
|
||||
windows_[i].output_group_->visible_ = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -409,8 +403,8 @@ void DisplaysView::draw()
|
||||
windows_[i].title_->translation_.y = 1.f + windows_[i].title_->scale_.y;
|
||||
}
|
||||
|
||||
windows_[i].output_frame_->scale_ = Settings::application.windows[i+1].scale;
|
||||
windows_[i].output_frame_->translation_ = Settings::application.windows[i+1].translation;
|
||||
windows_[i].output_group_->scale_ = Settings::application.windows[i+1].scale;
|
||||
windows_[i].output_group_->translation_ = Settings::application.windows[i+1].translation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,9 +686,15 @@ std::pair<Node *, glm::vec2> DisplaysView::pick(glm::vec2 P)
|
||||
(pick.first == windows_[i].menu_) ) {
|
||||
current_window_ = i;
|
||||
windows_[i].overlays_->setActive(1);
|
||||
windows_[i].output_handles_->visible_ = true;
|
||||
windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 1.f );
|
||||
windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 1.f );
|
||||
}
|
||||
else {
|
||||
windows_[i].overlays_->setActive(0);
|
||||
windows_[i].output_handles_->visible_ = false;
|
||||
windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 0.3f );
|
||||
windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 0.8f );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,12 +733,12 @@ void DisplaysView::select(glm::vec2 A, glm::vec2 B)
|
||||
// cancel previous current
|
||||
if (current_window_>-1) {
|
||||
windows_[current_window_].overlays_->setActive(0);
|
||||
windows_[current_window_].output_frame_->visible_ = false;
|
||||
windows_[current_window_].output_group_->visible_ = false;
|
||||
}
|
||||
// set current
|
||||
current_window_ = (int) std::distance(windows_.begin(), w);
|
||||
windows_[current_window_].overlays_->setActive(1);
|
||||
windows_[current_window_].output_frame_->visible_ = true;
|
||||
windows_[current_window_].output_group_->visible_ = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -757,7 +757,7 @@ void DisplaysView::initiate()
|
||||
current_window_status_->update(0.f);
|
||||
|
||||
// store status current output frame in current window
|
||||
current_output_status_->copyTransform(windows_[current_window_].output_frame_);
|
||||
current_output_status_->copyTransform(windows_[current_window_].output_group_);
|
||||
current_output_status_->update(0.f);
|
||||
|
||||
// initiated
|
||||
@@ -787,17 +787,17 @@ void DisplaysView::terminate(bool force)
|
||||
GlmToolkit::AxisAlignedBoundingBox _bb;
|
||||
_bb.extend(glm::vec3(-1.f, -1.f, 0.f));
|
||||
_bb.extend(glm::vec3(1.f, 1.f, 0.f));
|
||||
GlmToolkit::AxisAlignedBoundingBox output_bb = _bb.transformed( windows_[current_window_].output_frame_->transform_ );
|
||||
GlmToolkit::AxisAlignedBoundingBox output_bb = _bb.transformed( windows_[current_window_].output_group_->transform_ );
|
||||
_bb = _bb.scaled(glm::vec3(0.9f));
|
||||
if ( !_bb.intersect(output_bb) || output_bb.area() < 0.1f ) {
|
||||
// No intersection of output bounding box with window area : revert to previous
|
||||
windows_[current_window_].output_frame_->scale_ = Settings::application.windows[current_window_+1].scale;
|
||||
windows_[current_window_].output_frame_->translation_ = Settings::application.windows[current_window_+1].translation;
|
||||
windows_[current_window_].output_group_->scale_ = Settings::application.windows[current_window_+1].scale;
|
||||
windows_[current_window_].output_group_->translation_ = Settings::application.windows[current_window_+1].translation;
|
||||
}
|
||||
else {
|
||||
// Apply output area recentering to actual output window
|
||||
Settings::application.windows[current_window_+1].scale = windows_[current_window_].output_frame_->scale_;
|
||||
Settings::application.windows[current_window_+1].translation = windows_[current_window_].output_frame_->translation_;
|
||||
Settings::application.windows[current_window_+1].scale = windows_[current_window_].output_group_->scale_;
|
||||
Settings::application.windows[current_window_+1].translation = windows_[current_window_].output_group_->translation_;
|
||||
}
|
||||
|
||||
// reset overlay of grab corner
|
||||
@@ -874,16 +874,16 @@ View::Cursor DisplaysView::grab (Source *, glm::vec2 from, glm::vec2 to, std::pa
|
||||
// calculate proportional scaling factor
|
||||
float factor = glm::length( glm::vec2( corner_to ) ) / glm::length( glm::vec2( corner_from ) );
|
||||
// scale node
|
||||
windows_[current_window_].output_frame_->scale_ = current_output_status_->scale_ * glm::vec3(factor, factor, 1.f);
|
||||
windows_[current_window_].output_group_->scale_ = current_output_status_->scale_ * glm::vec3(factor, factor, 1.f);
|
||||
}
|
||||
// non-proportional CORNER RESIZE (normal case)
|
||||
else {
|
||||
// scale node
|
||||
windows_[current_window_].output_frame_->scale_ = current_output_status_->scale_ * corner_scaling;
|
||||
windows_[current_window_].output_group_->scale_ = current_output_status_->scale_ * corner_scaling;
|
||||
}
|
||||
|
||||
// update corner scaling to apply to center coordinates
|
||||
corner_scaling = windows_[current_window_].output_frame_->scale_ / current_output_status_->scale_;
|
||||
corner_scaling = windows_[current_window_].output_group_->scale_ / current_output_status_->scale_;
|
||||
|
||||
// TRANSLATION CORNER
|
||||
// convert source position in corner reference frame
|
||||
@@ -893,12 +893,12 @@ View::Cursor DisplaysView::grab (Source *, glm::vec2 from, glm::vec2 to, std::pa
|
||||
// convert center back into scene reference frame
|
||||
center = corner_to_root_transform * center;
|
||||
// apply to node
|
||||
windows_[current_window_].output_frame_->translation_ = glm::vec3(center);
|
||||
windows_[current_window_].output_group_->translation_ = glm::vec3(center);
|
||||
|
||||
// discretized scaling with ALT
|
||||
if (UserInterface::manager().altModifier()) {
|
||||
windows_[current_window_].output_frame_->scale_ = glm::round( windows_[current_window_].output_frame_->scale_ * 20.f) * 0.05f;
|
||||
windows_[current_window_].output_frame_->translation_ = glm::round( windows_[current_window_].output_frame_->translation_ * 20.f) * 0.05f;
|
||||
windows_[current_window_].output_group_->scale_ = glm::round( windows_[current_window_].output_group_->scale_ * 20.f) * 0.05f;
|
||||
windows_[current_window_].output_group_->translation_ = glm::round( windows_[current_window_].output_group_->translation_ * 20.f) * 0.05f;
|
||||
}
|
||||
|
||||
// show cursor depending on diagonal (corner picked)
|
||||
@@ -907,8 +907,8 @@ View::Cursor DisplaysView::grab (Source *, glm::vec2 from, glm::vec2 to, std::pa
|
||||
corner = T * glm::vec4( corner, 0.f, 0.f );
|
||||
ret.type = corner.x * corner.y > 0.f ? Cursor_ResizeNESW : Cursor_ResizeNWSE;
|
||||
|
||||
info << "Output resized " << std::fixed << std::setprecision(1) << 100.f * windows_[current_window_].output_frame_->scale_.x;
|
||||
info << " x " << 100.f * windows_[current_window_].output_frame_->scale_.y << " %";
|
||||
info << "Output resized " << std::fixed << std::setprecision(1) << 100.f * windows_[current_window_].output_group_->scale_.x;
|
||||
info << " x " << 100.f * windows_[current_window_].output_group_->scale_.y << " %";
|
||||
}
|
||||
|
||||
// grab window not fullscreen : move or resizes
|
||||
|
||||
@@ -11,7 +11,8 @@ struct WindowPreview
|
||||
class FrameBufferSurface *surface_;
|
||||
Surface *output_render_;
|
||||
Group *root_;
|
||||
Group *output_frame_;
|
||||
Group *output_group_;
|
||||
Frame *output_frame_;
|
||||
Handles *output_handles_;
|
||||
Switch *overlays_;
|
||||
Switch *mode_;
|
||||
@@ -28,7 +29,7 @@ struct WindowPreview
|
||||
surface_ = nullptr;
|
||||
output_render_ = nullptr;
|
||||
root_ = nullptr;
|
||||
output_frame_ = nullptr;
|
||||
output_group_ = nullptr;
|
||||
output_handles_ = nullptr;
|
||||
overlays_ = nullptr;
|
||||
mode_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user