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
769ed207
authored
Apr 21, 2022
by
Herman Ounas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vaike merge fix.
parent
d860081d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
78 deletions
tab.c
ui.c
tab.c
View file @
769ed207
...
@@ -49,9 +49,9 @@ void LisaTab(ui *UI)
...
@@ -49,9 +49,9 @@ void LisaTab(ui *UI)
// Status bar
// Status bar
Tab
->
StatusBar
=
gtk_statusbar_new
();
Tab
->
StatusBar
=
gtk_statusbar_new
();
// Teksti muutuse callback
// Teksti muutuse callback
g_signal_connect
(
Tab
->
Puhver
,
"changed"
,
G_CALLBACK
(
TekstMuudetud
),
Tab
);
//
g_signal_connect(Tab->Puhver, "changed", G_CALLBACK(TekstMuudetud), Tab);
// Modified callback
// Modified callback
g_signal_connect
(
Tab
->
Puhver
,
"modified-changed"
,
G_CALLBACK
(
TekstModifie
d
),
Tab
);
g_signal_connect
(
Tab
->
Puhver
,
"modified-changed"
,
G_CALLBACK
(
UuendaTabMuudetu
d
),
Tab
);
// Copy/paste lohistamise callback, uuendab samuti
// Copy/paste lohistamise callback, uuendab samuti
g_signal_connect_object
(
Tab
->
Puhver
,
"mark_set"
,
G_CALLBACK
(
TekstMarkSet
),
Tab
->
StatusBar
,
0
);
g_signal_connect_object
(
Tab
->
Puhver
,
"mark_set"
,
G_CALLBACK
(
TekstMarkSet
),
Tab
->
StatusBar
,
0
);
...
@@ -178,78 +178,3 @@ void SeaFont(ui *UI, char *FondiNimi)
...
@@ -178,78 +178,3 @@ void SeaFont(ui *UI, char *FondiNimi)
gtk_widget_show_all
(
UI
->
Tabid
[
i
].
TextView
);
gtk_widget_show_all
(
UI
->
Tabid
[
i
].
TextView
);
}
}
}
}
// Loo uus vahekaart ja pane see lõppu
void
LisaTab
(
ui
*
UI
)
{
int
TabidN
=
UI
->
TabidN
;
if
(
TabidN
==
0
)
{
UI
->
Tabid
=
g_malloc
(
sizeof
(
tab
));
// Loo massiiv, kui see pole olemas
}
else
{
UI
->
Tabid
=
g_realloc
(
UI
->
Tabid
,
sizeof
(
tab
)
*
(
TabidN
+
1
));
// Lisa vahekaart massiivi
// Kuna realloc liigutab vahekaardid mälus uude kohta, siis tuleb
// tekstipuhvrite muutmise callback'ile anda uued viidad
for
(
int
i
=
0
;
i
<
UI
->
TabidN
;
i
++
)
{
tab
*
Tab
=
&
UI
->
Tabid
[
i
];
g_signal_handler_disconnect
(
Tab
->
Puhver
,
Tab
->
MuudetudID
);
Tab
->
MuudetudID
=
g_signal_connect
(
Tab
->
Puhver
,
"modified-changed"
,
G_CALLBACK
(
UuendaTabMuudetud
),
Tab
);
}
}
tab
*
Tab
=
&
UI
->
Tabid
[
TabidN
];
UI
->
TabidN
++
;
Tab
->
FailiNimi
=
0
;
// Faili veel pole
Tab
->
Aken
=
UI
->
Aken
;
// Tekstiaken
Tab
->
TextView
=
gtk_source_view_new
();
// Loo tekstiaken
Tab
->
Puhver
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
Tab
->
TextView
));
// Tekstiakna teksti puhver
// Kui font on seadistatud, siis kasuta seda
char
*
FondiNimi
=
g_key_file_get_string
(
UI
->
Seaded
,
"Seaded"
,
"font"
,
NULL
);
if
(
FondiNimi
)
{
gtk_widget_modify_font
(
Tab
->
TextView
,
pango_font_description_from_string
(
FondiNimi
));
g_free
(
FondiNimi
);
}
// Scroll window
Tab
->
ScrollWindow
=
gtk_scrolled_window_new
(
NULL
,
NULL
);
// Loo scroll aken
gtk_container_add
(
GTK_CONTAINER
(
Tab
->
ScrollWindow
),
Tab
->
TextView
);
// Scroll aknasse läheb tekstiaken
gtk_scrolled_window_set_policy
(
GTK_SCROLLED_WINDOW
(
Tab
->
ScrollWindow
),
GTK_POLICY_AUTOMATIC
,
GTK_POLICY_AUTOMATIC
);
// Konfigureerimine
gtk_scrolled_window_set_shadow_type
(
GTK_SCROLLED_WINDOW
(
Tab
->
ScrollWindow
),
GTK_SHADOW_ETCHED_IN
);
// Status bar
Tab
->
StatusBar
=
gtk_statusbar_new
();
// Modified callback
Tab
->
MuudetudID
=
g_signal_connect
(
Tab
->
Puhver
,
"modified-changed"
,
G_CALLBACK
(
UuendaTabMuudetud
),
Tab
);
// Teksti muutuse callback
g_signal_connect_object
(
Tab
->
Puhver
,
"mark_set"
,
G_CALLBACK
(
TekstMarkSet
),
Tab
->
StatusBar
,
0
);
// Box
Tab
->
Box
=
gtk_box_new
(
GTK_ORIENTATION_VERTICAL
,
0
);
// Vertikaalne box, 0px vahe
gtk_box_pack_start
(
GTK_BOX
(
Tab
->
Box
),
Tab
->
ScrollWindow
,
TRUE
,
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
Tab
->
Box
),
Tab
->
StatusBar
,
FALSE
,
FALSE
,
0
);
// Pealkiri
Tab
->
Pealkiri
=
gtk_label_new
(
"(uus)"
);
Tab
->
PealkiriTekst
=
"(uus)"
;
// Language manager (süntaksi värvimine)
Tab
->
LangManager
=
gtk_source_language_manager_get_default
();
Tab
->
Language
=
gtk_source_language_manager_get_language
(
Tab
->
LangManager
,
"c"
);
gtk_source_buffer_set_language
(
Tab
->
Puhver
,
Tab
->
Language
);
// Lisa loodud tab notebook'i
gtk_notebook_append_page
(
GTK_NOTEBOOK
(
UI
->
Notebook
),
Tab
->
Box
,
Tab
->
Pealkiri
);
gtk_widget_show_all
(
UI
->
Notebook
);
// Värskenda, et näha oleks
UuendaRidaVeerg
(
GTK_TEXT_BUFFER
(
Tab
->
Puhver
),
GTK_STATUSBAR
(
Tab
->
StatusBar
));
// Uuenda status bar'i, et seal midagi oleks
gtk_source_view_set_show_line_numbers
(
GTK_SOURCE_VIEW
(
Tab
->
TextView
),
TRUE
);
//naita reanumbrid
}
ui.c
View file @
769ed207
...
@@ -177,7 +177,7 @@ ui *LooUI()
...
@@ -177,7 +177,7 @@ ui *LooUI()
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKompileeri
,
Kompileeri
,
GDK_KEY_C
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Kompileeri
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKompileeri
,
Kompileeri
,
GDK_KEY_C
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Kompileeri
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKaivita
,
KaivitaProgramm
,
GDK_KEY_R
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Käivita programm
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKaivita
,
KaivitaProgramm
,
GDK_KEY_R
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Käivita programm
//Isikparastamise menuu
//Isikparastamise menuu
LisaMenuItem
(
UI
,
IsikupMenu
,
IsikupSeadedNup
p
,
Chooser
,
0
,
0
);
LisaMenuItem
(
UI
,
SeadedMenu
,
SeadedMenuIsiku
p
,
Chooser
,
0
,
0
);
LisaMenuItem
(
UI
,
SeadedMenu
,
SeadedMenuFont
,
FontSeaded
,
0
,
0
);
LisaMenuItem
(
UI
,
SeadedMenu
,
SeadedMenuFont
,
FontSeaded
,
0
,
0
);
//ToolBar
//ToolBar
...
...
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