Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
karudu
/
C-editor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cd8c5722
authored
Mar 23, 2022
by
karudu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotkeyd menüü nuppude jaoks
parent
4e267cd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
15 deletions
ceditor.h
ui.c
ui.h
ceditor.h
View file @
cd8c5722
...
@@ -25,6 +25,11 @@ typedef struct
...
@@ -25,6 +25,11 @@ typedef struct
GtkWidget
*
Box
;
// Akna box
GtkWidget
*
Box
;
// Akna box
GtkWidget
*
MenuBar
;
// Ülaosa menüü
GtkWidget
*
MenuBar
;
// Ülaosa menüü
GtkWidget
*
Notebook
;
// Notebook vahekaartidega
GtkWidget
*
Notebook
;
// Notebook vahekaartidega
<<<<<<<
Updated
upstream
=======
GtkWidget
*
ToolBar
;
//Tool bar
GtkWidget
*
AccelGroup
;
// Accel group nuppude jaoks
>>>>>>>
Stashed
changes
// Viited nuppudele nende sisse/välja lülitamiseks
// Viited nuppudele nende sisse/välja lülitamiseks
GtkWidget
*
FailMenuAva
;
GtkWidget
*
FailMenuAva
;
...
...
ui.c
View file @
cd8c5722
...
@@ -38,6 +38,14 @@ void Valju(GtkWidget *Nupp, gpointer Data)
...
@@ -38,6 +38,14 @@ void Valju(GtkWidget *Nupp, gpointer Data)
if
(
Sulge
(
UI
))
gtk_main_quit
();;
if
(
Sulge
(
UI
))
gtk_main_quit
();;
}
}
// Lisa menüüsse menu item
void
LisaMenuItem
(
ui
*
UI
,
GtkWidget
*
Menu
,
GtkWidget
*
MenuItem
,
void
*
Callback
,
guint
Nupp
,
GdkModifierType
NuppMask
)
{
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
MenuItem
);
g_signal_connect
(
MenuItem
,
"activate"
,
G_CALLBACK
(
Callback
),
UI
);
if
(
Nupp
)
gtk_widget_add_accelerator
(
MenuItem
,
"activate"
,
UI
->
AccelGroup
,
Nupp
,
NuppMask
,
GTK_ACCEL_VISIBLE
);
}
// Loo programmi kasutajaliides
// Loo programmi kasutajaliides
ui
*
LooUI
()
ui
*
LooUI
()
{
{
...
@@ -63,6 +71,10 @@ ui *LooUI()
...
@@ -63,6 +71,10 @@ ui *LooUI()
LisaTab
(
UI
);
LisaTab
(
UI
);
UI
->
PraeguneTab
=
0
;
UI
->
PraeguneTab
=
0
;
// Accel group
UI
->
AccelGroup
=
gtk_accel_group_new
();
gtk_window_add_accel_group
(
UI
->
Aken
,
UI
->
AccelGroup
);
// Menu bar
// Menu bar
UI
->
MenuBar
=
gtk_menu_bar_new
();
// Loo menu bar
UI
->
MenuBar
=
gtk_menu_bar_new
();
// Loo menu bar
GtkWidget
*
FailMenuNupp
=
gtk_menu_item_new_with_label
(
"Fail"
);
// Fail
GtkWidget
*
FailMenuNupp
=
gtk_menu_item_new_with_label
(
"Fail"
);
// Fail
...
@@ -84,21 +96,15 @@ ui *LooUI()
...
@@ -84,21 +96,15 @@ ui *LooUI()
// Menüüd nuppudesse
// Menüüd nuppudesse
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
FailMenuNupp
),
FailMenu
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
FailMenuNupp
),
FailMenu
);
// Fail menüü
// Fail menüü
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuUus
);
// Fail->Uus vahekaart
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuUus
,
Uus
,
GDK_KEY_N
,
GDK_CONTROL_MASK
);
// Fail->Uus vahekaart
g_signal_connect
(
FailMenuUus
,
"activate"
,
G_CALLBACK
(
Uus
),
UI
);
MenuSeparator
(
FailMenu
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
gtk_separator_menu_item_new
());
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuAva
,
Ava
,
GDK_KEY_O
,
GDK_CONTROL_MASK
);
// Fail->Ava
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuAva
);
// Fail->Ava
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuSalvesta
,
Salvesta
,
GDK_KEY_S
,
GDK_CONTROL_MASK
);
// Fail->Salvesta
g_signal_connect
(
FailMenuAva
,
"activate"
,
G_CALLBACK
(
Ava
),
UI
);
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuSalvestaN
,
SalvestaNimega
,
GDK_KEY_S
,
GDK_CONTROL_MASK
|
GDK_MOD1_MASK
);
// Fail->Salvesta nimega
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuSalvesta
);
// Fail->Salvesta
MenuSeparator
(
FailMenu
);
g_signal_connect
(
FailMenuSalvesta
,
"activate"
,
G_CALLBACK
(
Salvesta
),
UI
);
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuSulgeV
,
SulgeVahekaart
,
GDK_KEY_W
,
GDK_CONTROL_MASK
);
// Fail->Sulge vahekaart
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuSalvestaN
);
// Fail->Salvesta nimega
MenuSeparator
(
FailMenu
);
g_signal_connect
(
FailMenuSalvestaN
,
"activate"
,
G_CALLBACK
(
SalvestaNimega
),
UI
);
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuValju
,
Valju
,
GDK_KEY_Q
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Fail->Välju
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
gtk_separator_menu_item_new
());
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuSulgeV
);
// Fail->Sulge vahekaart
g_signal_connect
(
FailMenuSulgeV
,
"activate"
,
G_CALLBACK
(
SulgeVahekaart
),
UI
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
gtk_separator_menu_item_new
());
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuValju
);
// Fail->Välju
g_signal_connect
(
FailMenuValju
,
"activate"
,
G_CALLBACK
(
Valju
),
UI
);
// Pane kõik õiges järjekorras box'i
// Pane kõik õiges järjekorras box'i
gtk_box_pack_start
(
GTK_BOX
(
UI
->
Box
),
UI
->
MenuBar
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
UI
->
Box
),
UI
->
MenuBar
,
FALSE
,
FALSE
,
0
);
...
...
ui.h
View file @
cd8c5722
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#define PEALKIRI "CEditor TextView"
#define PEALKIRI "CEditor TextView"
#endif
#endif
#define MenuSeparator(M) gtk_menu_shell_append(GTK_MENU_SHELL(M), gtk_separator_menu_item_new())
ui
*
LooUI
();
ui
*
LooUI
();
#endif // UI_H
#endif // UI_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment