Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
c0731dbc
Commit
c0731dbc
authored
Nov 19, 2012
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
first try at implementing better resize of message browser
parent
36945c13
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Fltk/graphicWindow.cpp
+37
-9
37 additions, 9 deletions
Fltk/graphicWindow.cpp
Fltk/graphicWindow.h
+1
-0
1 addition, 0 deletions
Fltk/graphicWindow.h
Fltk/mainWindow.h
+10
-7
10 additions, 7 deletions
Fltk/mainWindow.h
Fltk/paletteWindow.h
+8
-9
8 additions, 9 deletions
Fltk/paletteWindow.h
with
56 additions
and
25 deletions
Fltk/graphicWindow.cpp
+
37
−
9
View file @
c0731dbc
...
...
@@ -2653,10 +2653,9 @@ static void message_browser_cb(Fl_Widget *w, void *data)
g
->
copySelectedMessagesToClipboard
();
}
// This dummy box class permits to define a box widget that will not
// eat the FL_ENTER/FL_LEAVE events (the new Box widget in fltk > 1.1
// does that, so that gl->handle() was not called when the mouse
// moved)
// This dummy box class permits to define a box widget that will not eat the
// FL_ENTER/FL_LEAVE events (the box widget in fltk > 1.1 does that, so that
// gl->handle() was not called when the mouse moved)
class
dummyBox
:
public
Fl_Box
{
private:
int
handle
(
int
){
return
0
;
}
// always!
...
...
@@ -2664,6 +2663,27 @@ class dummyBox : public Fl_Box {
dummyBox
(
int
x
,
int
y
,
int
w
,
int
h
,
const
char
*
l
=
0
)
:
Fl_Box
(
x
,
y
,
w
,
h
,
l
)
{}
};
// The main graphic window has a special resize behaviour forcing the message
// tile to always keep its height
class
mainWindowSpecialResize
:
public
mainWindow
{
public:
mainWindowSpecialResize
(
int
w
,
int
h
,
bool
nonModal
,
const
char
*
l
=
0
)
:
mainWindow
(
w
,
h
,
nonModal
,
l
)
{}
virtual
void
resize
(
int
X
,
int
Y
,
int
W
,
int
H
)
{
bool
special
=
(
shown
()
&&
this
==
FlGui
::
instance
()
->
graph
[
0
]
->
getWindow
());
int
old_mh
=
0
;
if
(
special
)
old_mh
=
FlGui
::
instance
()
->
graph
[
0
]
->
getMessageHeight
();
Fl_Window
::
resize
(
X
,
Y
,
W
,
H
);
const
int
minimum_non_message_height
=
100
;
if
(
special
&&
old_mh
<
h
()
-
minimum_non_message_height
){
int
mh
=
FlGui
::
instance
()
->
graph
[
0
]
->
getMessageHeight
();
FlGui
::
instance
()
->
graph
[
0
]
->
resizeMessages
(
old_mh
-
mh
);
}
}
};
graphicWindow
::
graphicWindow
(
bool
main
,
int
numTiles
,
bool
detachedMenu
)
:
_autoScrollMessages
(
true
)
{
...
...
@@ -2713,7 +2733,7 @@ graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu)
// the graphic window should be a "normal" window (neither modal nor
// non-modal)
if
(
main
){
_win
=
new
mainWindow
(
width
,
height
,
false
);
_win
=
new
mainWindow
SpecialResize
(
width
,
height
,
false
);
_win
->
callback
(
file_quit_cb
);
}
else
{
...
...
@@ -2820,9 +2840,9 @@ graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu)
_butt
[
i
]
->
align
(
FL_ALIGN_CENTER
|
FL_ALIGN_INSIDE
|
FL_ALIGN_CLIP
);
}
x
+=
2
;
x
+=
4
;
_label
=
new
Fl_Progress
(
x
,
mh
+
glheight
+
mheight
+
2
,
width
-
x
,
sht
);
_label
->
box
(
FL_
THIN_DOWN
_BOX
);
_label
->
box
(
FL_
FLAT
_BOX
);
_label
->
align
(
FL_ALIGN_LEFT
|
FL_ALIGN_INSIDE
|
FL_ALIGN_CLIP
);
_label
->
color
(
FL_BACKGROUND_COLOR
,
FL_DARK2
);
// FL_DARK_GREEN
...
...
@@ -2878,7 +2898,7 @@ graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu)
if
(
main
){
_browser
=
new
Fl_Browser
(
twidth
,
mh
+
glheight
,
glwidth
,
mheight
);
_browser
->
box
(
FL_THIN_DOWN
_BOX
);
_browser
->
box
(
GMSH_SIMPLE_TOP
_BOX
);
_browser
->
textfont
(
FL_COURIER
);
_browser
->
textsize
(
FL_NORMAL_SIZE
-
1
);
_browser
->
type
(
FL_MULTI_BROWSER
);
...
...
@@ -3189,6 +3209,7 @@ int graphicWindow::getGlWidth()
void
graphicWindow
::
setGlWidth
(
int
w
)
{
_win
->
size
(
w
,
_win
->
h
());
_win
->
redraw
();
// workaround resizing bug on Mac
_win
->
size_range
(
_minWidth
,
_minHeight
);
}
...
...
@@ -3197,7 +3218,8 @@ void graphicWindow::setGlHeight(int h)
{
int
hh
=
h
+
_bottom
->
h
();
if
(
_bar
)
hh
+=
_bar
->
h
();
_win
->
size
(
_win
->
w
(),
h
);
_win
->
size
(
_win
->
w
(),
hh
);
_win
->
redraw
();
// workaround resizing bug on Mac
_win
->
size_range
(
_minWidth
,
_minHeight
);
}
...
...
@@ -3243,6 +3265,12 @@ void graphicWindow::showHideMessages()
}
int
graphicWindow
::
getMessageHeight
()
{
if
(
!
_browser
)
return
0
;
return
_browser
->
h
();
}
int
graphicWindow
::
getSavedMessageHeight
()
{
if
(
!
_browser
)
return
0
;
if
(
!
_browser
->
h
())
return
_savedMessageHeight
;
...
...
This diff is collapsed.
Click to expand it.
Fltk/graphicWindow.h
+
1
−
0
View file @
c0731dbc
...
...
@@ -82,6 +82,7 @@ class graphicWindow{
void
saveMessages
(
const
char
*
filename
);
void
copySelectedMessagesToClipboard
();
int
getMessageHeight
();
int
getSavedMessageHeight
();
void
fillRecentHistoryMenu
();
};
...
...
This diff is collapsed.
Click to expand it.
Fltk/mainWindow.h
+
10
−
7
View file @
c0731dbc
...
...
@@ -12,8 +12,13 @@
// Derive the main window from Fl_Window (it shows up faster that way)
class
mainWindow
:
public
Fl_Window
{
private:
int
handle
(
int
event
)
public:
mainWindow
(
int
w
,
int
h
,
bool
nonModal
,
const
char
*
l
=
0
)
:
Fl_Window
(
w
,
h
,
l
)
{
if
(
nonModal
)
set_non_modal
();
}
virtual
int
handle
(
int
event
)
{
switch
(
event
)
{
case
FL_SHORTCUT
:
...
...
@@ -33,13 +38,11 @@ class mainWindow : public Fl_Window {
}
return
Fl_Window
::
handle
(
event
);
}
public
:
mainWindow
(
int
w
,
int
h
,
bool
nonModal
,
const
char
*
l
=
0
)
:
Fl_Window
(
w
,
h
,
l
)
virtual
void
resize
(
int
X
,
int
Y
,
int
W
,
int
H
)
{
if
(
nonModal
)
set_non_modal
(
);
Fl_Window
::
resize
(
X
,
Y
,
W
,
H
);
}
void
show
()
virtual
void
show
()
{
if
(
non_modal
()
&&
!
shown
())
Fl_Window
::
show
();
// fix ordering
Fl_Window
::
show
();
...
...
This diff is collapsed.
Click to expand it.
Fltk/paletteWindow.h
+
8
−
9
View file @
c0731dbc
...
...
@@ -12,8 +12,13 @@
// Derive special windows from Fl_Double_Window to correctly process
// the OS-specific shorcuts (Esc & Cmd-w on Mac, Alt+F4 on Windows)
class
paletteWindow
:
public
Fl_Double_Window
{
private:
int
handle
(
int
event
)
public:
paletteWindow
(
int
w
,
int
h
,
bool
nonModal
,
const
char
*
l
=
0
)
:
Fl_Double_Window
(
w
,
h
,
l
)
{
if
(
nonModal
)
set_non_modal
();
}
virtual
int
handle
(
int
event
)
{
switch
(
event
)
{
case
FL_SHORTCUT
:
...
...
@@ -32,13 +37,7 @@ class paletteWindow : public Fl_Double_Window {
}
return
Fl_Double_Window
::
handle
(
event
);
}
public
:
paletteWindow
(
int
w
,
int
h
,
bool
nonModal
,
const
char
*
l
=
0
)
:
Fl_Double_Window
(
w
,
h
,
l
)
{
if
(
nonModal
)
set_non_modal
();
}
void
show
()
virtual
void
show
()
{
if
(
non_modal
()
&&
!
shown
())
Fl_Double_Window
::
show
();
// fix ordering
Fl_Double_Window
::
show
();
...
...
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