Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Enhanced Ground Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Enhanced Ground Software
Commits
f32848f3
Commit
f32848f3
authored
7 months ago
by
Alberto Nidasio
Browse files
Options
Downloads
Patches
Plain Diff
Currently hovered pane can now be maximized with SHIFT+ESC
parent
7bae3ab1
Branches
Branches containing commit
No related tags found
1 merge request
!1
Pane maximization
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ui.rs
+1
-0
1 addition, 0 deletions
src/ui.rs
src/ui/composable_view.rs
+35
-2
35 additions, 2 deletions
src/ui/composable_view.rs
src/ui/utils.rs
+13
-0
13 additions, 0 deletions
src/ui/utils.rs
with
49 additions
and
2 deletions
src/ui.rs
+
1
−
0
View file @
f32848f3
...
...
@@ -2,5 +2,6 @@ mod composable_view;
mod
layout_manager
;
mod
panes
;
mod
shortcuts
;
mod
utils
;
pub
use
composable_view
::
ComposableView
;
This diff is collapsed.
Click to expand it.
src/ui/composable_view.rs
+
35
−
2
View file @
f32848f3
use
super
::{
layout_manager
::
LayoutManager
,
panes
::{
Pane
,
PaneBehavior
},
panes
::{
Pane
,
PaneBehavior
,
PaneKind
},
shortcuts
,
utils
::
maximized_pane_ui
,
};
use
std
::{
fs
,
...
...
@@ -19,6 +20,7 @@ pub struct ComposableView {
pub
layout_manager
:
LayoutManager
,
behavior
:
ComposableBehavior
,
maximized_pane
:
Option
<
TileId
>
,
}
// An app must implement the `App` trait to define how the ui is built
...
...
@@ -44,6 +46,7 @@ impl eframe::App for ComposableView {
((
Modifiers
::
NONE
,
Key
::
V
),
PaneAction
::
SplitV
),
((
Modifiers
::
NONE
,
Key
::
H
),
PaneAction
::
SplitH
),
((
Modifiers
::
NONE
,
Key
::
C
),
PaneAction
::
Close
),
((
Modifiers
::
SHIFT
,
Key
::
Escape
),
PaneAction
::
Maximize
),
];
pane_action
=
pane_action
.or
(
shortcuts
::
map_to_action
(
ctx
,
&
key_action_pairs
[
..
])
.map
(|
action
|
(
action
,
hovered_pane
)));
...
...
@@ -87,6 +90,27 @@ impl eframe::App for ComposableView {
PaneAction
::
Replace
(
new_pane
)
=>
{
panes_tree
.tiles
.insert
(
hovered_tile
,
Tile
::
Pane
(
*
new_pane
));
}
PaneAction
::
Maximize
=>
{
// This is a toggle: if there is not currently a maximized pane,
// maximize the hovered pane, otherwize remove the maximized pane.
if
self
.maximized_pane
.is_some
()
{
self
.maximized_pane
=
None
;
}
else
{
let
hovered_pane_is_default
=
panes_tree
.tiles
.get
(
hovered_tile
)
.map
(|
hovered_pane
|
match
hovered_pane
{
Tile
::
Pane
(
Pane
{
pane
:
PaneKind
::
Default
(
_
),
})
=>
true
,
_
=>
false
,
})
.unwrap_or
(
false
);
if
!
hovered_pane_is_default
{
self
.maximized_pane
=
Some
(
hovered_tile
);
}
}
}
}
}
...
...
@@ -103,7 +127,15 @@ impl eframe::App for ComposableView {
// A central panel covers the remainder of the screen, i.e. whatever area is left after adding other panels.
egui
::
CentralPanel
::
default
()
.show
(
ctx
,
|
ui
|
{
if
let
Some
(
maximized_pane
)
=
self
.maximized_pane
{
if
let
Some
(
Tile
::
Pane
(
pane
))
=
panes_tree
.tiles
.get_mut
(
maximized_pane
)
{
maximized_pane_ui
(
ui
,
pane
);
}
else
{
panic!
(
"Maximized pane not found in tree!"
);
}
}
else
{
panes_tree
.ui
(
&
mut
self
.behavior
,
ui
);
}
});
LayoutManager
::
show
(
self
,
ctx
);
...
...
@@ -246,4 +278,5 @@ pub enum PaneAction {
SplitV
,
Close
,
Replace
(
Box
<
Pane
>
),
Maximize
,
}
This diff is collapsed.
Click to expand it.
src/ui/utils.rs
0 → 100644
+
13
−
0
View file @
f32848f3
use
egui
::
containers
::
Frame
;
use
egui
::{
Shadow
,
Style
,
Ui
};
use
super
::
panes
::{
Pane
,
PaneBehavior
};
/// This function wraps a ui into a popup frame intended for the pane that needs
/// to be maximized on screen.
pub
fn
maximized_pane_ui
(
ui
:
&
mut
Ui
,
pane
:
&
mut
Pane
)
{
Frame
::
popup
(
&
Style
::
default
())
.fill
(
egui
::
Color32
::
TRANSPARENT
)
.shadow
(
Shadow
::
NONE
)
.show
(
ui
,
|
ui
|
pane
.ui
(
ui
));
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment