mirror of
https://gitlab.com/AutumnMeowMeow/jexer
synced 2024-09-19 11:50:19 -06:00
#14 TDesktop working, TWindow hide/show/max/restore working
This commit is contained in:
parent
9245321388
commit
8c236a9858
4 changed files with 121 additions and 23 deletions
13
docs/TODO.md
13
docs/TODO.md
|
@ -10,7 +10,14 @@ BUG: TTreeView.reflow() doesn't keep the vertical dot within the
|
|||
|
||||
0.0.5
|
||||
|
||||
- TDesktop (#14)
|
||||
|
||||
- Scrollable:
|
||||
- TTreeView
|
||||
- TText
|
||||
- TList
|
||||
- TTerminalWindow
|
||||
- TScrollableWindow
|
||||
|
||||
|
||||
- TWindow:
|
||||
- UNCLOSABLE (#8)
|
||||
|
@ -35,8 +42,8 @@ BUG: TTreeView.reflow() doesn't keep the vertical dot within the
|
|||
- Refactor SwingBackend to be embeddable
|
||||
- jexer.Swing.blockMousePointer: false = do not invert cell, true
|
||||
(default) is current behavior
|
||||
- Make Demo4 with two separate Swing demos in a single JFrame.
|
||||
- Make Demo5 mixing Swing and Jexer components
|
||||
- Make Demo5 with two separate Swing demos in a single JFrame.
|
||||
- Make Demo6 mixing Swing and Jexer components
|
||||
|
||||
- THelpWindow
|
||||
- TText + clickable links
|
||||
|
|
|
@ -1,6 +1,40 @@
|
|||
Jexer Work Log
|
||||
==============
|
||||
|
||||
July 15, 2017
|
||||
|
||||
I think I have cleaned up most of the window show/hide/activate mess
|
||||
in TApplication. Demo4 has some cool interactions between a
|
||||
background TDesktop and several foreground TWindows, which helped
|
||||
expose bugs.
|
||||
|
||||
July 9, 2017
|
||||
|
||||
While working on TWindow.hide/show I decided that I am sick of
|
||||
TApplication's active window handling. TApplication makes lots of
|
||||
assumptions, things are too fragile between modal and not, and one
|
||||
cannot easily say window.activate(). So I will also be changing that
|
||||
too. ... Code is still a bit of a mess, but hooks are in place at
|
||||
least for show/hide/activate.
|
||||
|
||||
July 8, 2017
|
||||
|
||||
Qodem 1.0.0 released last month, I had a vacation, and a Jexer user
|
||||
(nikiroo) started opening up pull requests. :-) So back unto the
|
||||
breach we go!
|
||||
|
||||
TButton is now animated so that there is some feedback when selected
|
||||
via keyboard. StringJustifier was written which permits TText's to
|
||||
have left/centered/right and full justification. TDesktop is now in
|
||||
too which can act as a permanent max-sized window without borders.
|
||||
|
||||
Next up is Viewport, an interface to collect scrollbar API, and then a
|
||||
cleaner API for scrollable widgets and windows. After that is more
|
||||
window API: hide/show/maximize/restore, and unclosable windows. I am
|
||||
cherry-picking bits from @nikiroo's PRs, which will likely break them
|
||||
before it fixes things, but I will find some way to get Niki credited
|
||||
with those pieces.
|
||||
|
||||
March 21, 2017
|
||||
|
||||
I am starting to gear up for making Jexer a serious project now. I've
|
||||
|
|
|
@ -1278,9 +1278,9 @@ public class TApplication implements Runnable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the number of windows that are visible.
|
||||
* Return the number of windows that are showing.
|
||||
*
|
||||
* @return the number of windows that are visible
|
||||
* @return the number of windows that are showing on screen
|
||||
*/
|
||||
public final int shownWindowCount() {
|
||||
int n = 0;
|
||||
|
@ -1292,6 +1292,21 @@ public class TApplication implements Runnable {
|
|||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of windows that are hidden.
|
||||
*
|
||||
* @return the number of windows that are hidden
|
||||
*/
|
||||
public final int hiddenWindowCount() {
|
||||
int n = 0;
|
||||
for (TWindow w: windows) {
|
||||
if (w.isHidden()) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a window instance is in this application's window list.
|
||||
*
|
||||
|
@ -1304,6 +1319,7 @@ public class TApplication implements Runnable {
|
|||
}
|
||||
for (TWindow w: windows) {
|
||||
if (w == window) {
|
||||
assert (window.getApplication() == this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1496,8 +1512,8 @@ public class TApplication implements Runnable {
|
|||
* otherwise switch to the previous window in the list
|
||||
*/
|
||||
public final void switchWindow(final boolean forward) {
|
||||
// Only switch if there are multiple windows
|
||||
if (windows.size() < 2) {
|
||||
// Only switch if there are multiple visible windows
|
||||
if (shownWindowCount() < 2) {
|
||||
return;
|
||||
}
|
||||
assert (activeWindow != null);
|
||||
|
@ -1522,18 +1538,23 @@ public class TApplication implements Runnable {
|
|||
return;
|
||||
}
|
||||
|
||||
int nextWindowI;
|
||||
if (forward) {
|
||||
nextWindowI = (activeWindowI + 1) % windows.size();
|
||||
} else {
|
||||
if (activeWindowI == 0) {
|
||||
nextWindowI = windows.size() - 1;
|
||||
int nextWindowI = activeWindowI;
|
||||
for (;;) {
|
||||
if (forward) {
|
||||
nextWindowI++;
|
||||
nextWindowI %= windows.size();
|
||||
} else {
|
||||
nextWindowI = activeWindowI - 1;
|
||||
nextWindowI--;
|
||||
if (nextWindowI < 0) {
|
||||
nextWindowI = windows.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (windows.get(nextWindowI).isShown()) {
|
||||
activateWindow(windows.get(nextWindowI));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
activateWindow(windows.get(nextWindowI));
|
||||
} // synchronized (windows)
|
||||
|
||||
}
|
||||
|
@ -1746,11 +1767,11 @@ public class TApplication implements Runnable {
|
|||
continue;
|
||||
}
|
||||
for (int x = w.getX(); x < w.getX() + w.getWidth(); x++) {
|
||||
if (x == width) {
|
||||
if (x >= width) {
|
||||
continue;
|
||||
}
|
||||
for (int y = w.getY(); y < w.getY() + w.getHeight(); y++) {
|
||||
if (y == height) {
|
||||
if (y >= height) {
|
||||
continue;
|
||||
}
|
||||
overlapMatrix[x][y]++;
|
||||
|
@ -1793,11 +1814,11 @@ public class TApplication implements Runnable {
|
|||
long newOverlapN = 0;
|
||||
// Start by adding each new cell.
|
||||
for (int wx = x; wx < x + window.getWidth(); wx++) {
|
||||
if (wx == width) {
|
||||
if (wx >= width) {
|
||||
continue;
|
||||
}
|
||||
for (int wy = y; wy < y + window.getHeight(); wy++) {
|
||||
if (wy == height) {
|
||||
if (wy >= height) {
|
||||
continue;
|
||||
}
|
||||
newMatrix[wx][wy]++;
|
||||
|
|
|
@ -69,8 +69,8 @@ public class DesktopDemoApplication extends TApplication {
|
|||
}
|
||||
);
|
||||
|
||||
final TWindow windowA = addWindow("Window A", 20, 14);
|
||||
final TWindow windowB = addWindow("Window B", 20, 14);
|
||||
final TWindow windowA = addWindow("Window A", 25, 14);
|
||||
final TWindow windowB = addWindow("Window B", 25, 14);
|
||||
windowA.addButton("&Show Window B", 2, 2,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
|
@ -85,6 +85,20 @@ public class DesktopDemoApplication extends TApplication {
|
|||
}
|
||||
}
|
||||
);
|
||||
windowA.addButton("&Maximize Window B", 2, 6,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
windowB.maximize();
|
||||
}
|
||||
}
|
||||
);
|
||||
windowA.addButton("&Restore Window B", 2, 8,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
windowB.restore();
|
||||
}
|
||||
}
|
||||
);
|
||||
windowB.addButton("&Show Window A", 2, 2,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
|
@ -99,8 +113,22 @@ public class DesktopDemoApplication extends TApplication {
|
|||
}
|
||||
}
|
||||
);
|
||||
windowB.addButton("&Maximize Window A", 2, 6,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
windowA.maximize();
|
||||
}
|
||||
}
|
||||
);
|
||||
windowB.addButton("&Restore Window A", 2, 8,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
windowA.restore();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
desktop.addButton("&Show Window B", 25, 2,
|
||||
desktop.addButton("S&how Window B", 25, 2,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
windowB.show();
|
||||
|
@ -128,6 +156,14 @@ public class DesktopDemoApplication extends TApplication {
|
|||
}
|
||||
}
|
||||
);
|
||||
desktop.addButton("&Create Window C", 25, 15,
|
||||
new TAction() {
|
||||
public void DO() {
|
||||
desktop.getApplication().addWindow("Window C",
|
||||
30, 20);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue