• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Virtual machine Management Terminal User Interface


Commit MetaInfo

Révisionf196706b2c9e5e461d7aea5b994546ad196d39f9 (tree)
l'heure2022-07-09 22:35:54
AuteurKoine Yuusuke(koinec) <koinec@user...>
CommiterKoine Yuusuke(koinec)

Message de Log

Improve TuiInfo Window change logic.

Change Summary

Modification

--- a/src/tuikey.c
+++ b/src/tuikey.c
@@ -68,6 +68,33 @@ int
6868 }
6969
7070 /* ===========================================================================*/
71+int
72+ TuiKey_ChangeInfoWindow(
73+ int i_direction )
74+{
75+ int i_type;
76+
77+ gi_infopage += i_direction;
78+
79+ i_type = TuiVmList_GetCursorType();
80+ if((VMLIST_TYPE_HVISOR == i_type) && (TUIINFO_GUEST == gi_infopage)) {
81+ if( 0 < i_direction ) { gi_infopage++; }
82+ else if( 0 > i_direction ) { gi_infopage--; }
83+ else { gi_infopage = TUIINFO_HVISOR; }
84+ }
85+ if((VMLIST_TYPE_GUEST == i_type) && (TUIINFO_HVISOR == gi_infopage)) {
86+ if( 0 < i_direction ) { gi_infopage++; }
87+ else if( 0 > i_direction ) { gi_infopage--; }
88+ else { gi_infopage = TUIINFO_GUEST; }
89+ }
90+
91+ if( TUIINFO_MAX < gi_infopage ) { gi_infopage = 0; }
92+ else if( 0 > gi_infopage ) { gi_infopage = TUIINFO_MAX; }
93+
94+ return 0x00;
95+}
96+
97+/* ===========================================================================*/
7198 VMTUI_TUIKEY_EXTERN
7299 int
73100 TuiKey_Dispatch(
@@ -92,16 +119,22 @@ int
92119 i_exit = 0x01;
93120 break;
94121 case 'h':
95- gi_infopage++;
96- if( TUIINFO_MAX <= gi_infopage )
97- { gi_infopage = 0; }
122+ TuiKey_ChangeInfoWindow( -1 );
123+ TuiSys_Draw();
124+ break;
125+ case 'l':
126+ TuiKey_ChangeInfoWindow( +1 );
98127 TuiSys_Draw();
99128 break;
100129 case 'j':
101130 TuiVmList_DownCursor();
131+ TuiKey_ChangeInfoWindow( 0 );
132+ TuiSys_Draw();
102133 break;
103134 case 'k':
104135 TuiVmList_UpCursor();
136+ TuiKey_ChangeInfoWindow( 0 );
137+ TuiSys_Draw();
105138 break;
106139 case 't':
107140 TuiKey_TestCode();
--- a/src/tuisys.h
+++ b/src/tuisys.h
@@ -56,28 +56,28 @@ VMTUI_TUISYS_EXTERN int gi_infopage;
5656 #define TUI_FOCUS_INFO 0x01
5757 #define TUI_FOCUS_KEYLINE 0x02
5858
59-#define TUIINFO_HVISOR 0x00
60-#define TUIINFO_GUEST 0x01
61-#define TUIINFO_CONSOLE 0x02
62-#define TUIINFO_ERRINFO 0x03
63-#define TUIINFO_HELP 0x04
64-#define TUIINFO_MAX TUIINFO_HELP
59+#define TUIINFO_HELP 0x00
60+#define TUIINFO_HVISOR 0x01
61+#define TUIINFO_GUEST 0x02
62+#define TUIINFO_CONSOLE 0x03
63+#define TUIINFO_ERRINFO 0x04
64+#define TUIINFO_MAX TUIINFO_ERRINFO
6565
6666 #ifdef VMTUI_SRC_TUISYS
6767 FuncTuiInfo_Update TuiInfo_Update[] = {
68+ TuiHelp_Update,
6869 TuiHVisor_Update,
6970 TuiGuest_Update,
7071 TuiConsole_Update,
71- TuiErrInfo_Update,
72- TuiHelp_Update
72+ TuiErrInfo_Update
7373 };
7474
7575 FuncTuiInfo_Draw TuiInfo_Draw[] = {
76+ TuiHelp_Draw,
7677 TuiHVisor_Draw,
7778 TuiGuest_Draw,
7879 TuiConsole_Draw,
79- TuiErrInfo_Draw,
80- TuiHelp_Draw
80+ TuiErrInfo_Draw
8181 };
8282
8383 SCREEN *gp_tuiscr = NULL;
--- a/src/tuivmlist.c
+++ b/src/tuivmlist.c
@@ -50,6 +50,22 @@ void
5050 }
5151
5252 /* ===========================================================================*/
53+VMTUI_TUIVMLIST_EXTERN
54+int
55+ TuiVmList_GetCursorType(
56+ void )
57+{
58+ VmList_Item *p_now;
59+
60+ p_now = gp_items + gi_line_now;
61+
62+ if( GUEST_ID_NONE != p_now->i_guest ) { return VMLIST_TYPE_GUEST; }
63+ if( HVISOR_ID_NONE != p_now-> i_hvisor ) { return VMLIST_TYPE_HVISOR; }
64+
65+ return -0x01;
66+}
67+
68+/* ===========================================================================*/
5369 VmList_Item *
5470 TuiVmList_GetItems(
5571 int i_item )
--- a/src/tuivmlist.h
+++ b/src/tuivmlist.h
@@ -47,6 +47,9 @@ typedef struct {
4747 #endif
4848 VMTUI_TUIVMLIST_EXTERN void TuiVmList_DownCursor( void );
4949 VMTUI_TUIVMLIST_EXTERN void TuiVmList_UpCursor( void );
50+VMTUI_TUIVMLIST_EXTERN int TuiVmList_GetCursorType( void );
51+ #define VMLIST_TYPE_HVISOR 0x00
52+ #define VMLIST_TYPE_GUEST 0x01
5053 VMTUI_TUIVMLIST_EXTERN int TuiVmList_Update( void );
5154 VMTUI_TUIVMLIST_EXTERN int TuiVmList_Draw( void );
5255 VMTUI_TUIVMLIST_EXTERN int TuiVmList_Init( void );