Skip to content

Commit 438a524

Browse files
committed
Remove deprecated routines
1 parent 079b1e0 commit 438a524

File tree

15 files changed

+33
-113
lines changed

15 files changed

+33
-113
lines changed

src/Data/History/archiver.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "observers.hpp"
1515
#include "tm_debug.hpp"
1616
#include "tree.hpp"
17-
#include "tree_helper.hpp"
1817
#include "tree_observer.hpp"
1918
#include "tree_patch.hpp"
2019

@@ -330,7 +329,7 @@ archiver_rep::confirm () {
330329
if (depth <= last_save) last_save= -1;
331330
if (depth <= last_autosave) last_autosave= -1;
332331
normalize ();
333-
show_all ();
332+
// show_all ();
334333
}
335334
}
336335
}
@@ -419,10 +418,7 @@ archiver_rep::redo_possibilities () {
419418

420419
path
421420
archiver_rep::undo_one (int i) {
422-
if (active ()) {
423-
cout << " Cannot undo while modifications are active\n";
424-
return path ();
425-
}
421+
if (active ()) return path ();
426422
cout << " undo_possibilities(): " << undo_possibilities () << "\n";
427423
if (undo_possibilities () != 0) {
428424
ASSERT (i == 0, "index out of range");
@@ -438,8 +434,7 @@ archiver_rep::undo_one (int i) {
438434
archive = make_history (un, re);
439435
depth--;
440436
// show_all ();
441-
path cursor_pos= cursor_hint (q, the_et);
442-
return cursor_pos;
437+
return cursor_hint (q, the_et);
443438
}
444439
return path ();
445440
}

src/Data/History/archiver.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class archiver_rep : public concrete_struct {
7373

7474
void reconstruct_from_state (path p_old, tree t_old, tree t_new);
7575
modification compute_tree_mod (path p_old, tree t_old, tree t_new);
76-
bool is_content_modification (patch p);
7776

7877
inline void set_versioning (bool v) { versioning= v; }
7978

src/Edit/Interface/edit_complete.cpp

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ edit_interface_rep::complete_try () {
8888
else {
8989
if ((end == 0) || (!is_iso_alpha (s[end - 1])) ||
9090
((end != N (s)) && is_iso_alpha (s[end]))) {
91-
complete_str= string ("");
9291
set_input_normal ();
9392
SERVER (set_completion_popup_visible (false));
9493
return false;
@@ -100,7 +99,6 @@ edit_interface_rep::complete_try () {
10099
a = find_completions (drd, et, ss);
101100
}
102101
if (N (a) <= 1) {
103-
complete_str= string ("");
104102
set_input_normal ();
105103
SERVER (set_completion_popup_visible (false));
106104
return false;
@@ -136,46 +134,26 @@ edit_interface_rep::complete_start (string prefix, array<string> compls) {
136134
completion_prefix= prefix;
137135
completions = close_completions (compls);
138136
completion_pos = 0;
139-
{
140-
// TODO: ?refactor this part to
141-
// edit_interface_rep::show_completion_popup
142-
cout << "complete_start: "
143-
// << "completions=" << completions
144-
<< ", prefix="
145-
<< completion_prefix
146-
// << ", tp=" << tp
147-
// << ", et=" << et
148-
// << ", eb=" << eb
149-
<< LF;
150-
array<string> full_completions;
151-
for (int i= 0; i < N (completions); ++i) {
152-
// cout << "complete_start: completions[" << i << "]=" << completions[i]
153-
// << LF;
154-
string c= completions[i];
155-
full_completions << (completion_prefix * c);
156-
}
157-
path tp1= tp;
158-
for (int i= 0; i < N (prefix); ++i) {
159-
tp1= previous_valid (et, tp1);
160-
}
161-
cursor cu= eb->find_check_cursor (tp1);
162-
cout << "show_completion_popup: "
163-
// << "completions=" << full_completions << ", cu->ox=" << cu->ox
164-
<< ", cu->oy=" << cu->oy << ", magf=" << magf
165-
<< ", scroll_x=" << get_scroll_x ()
166-
<< ", scroll_y=" << get_scroll_y ()
167-
<< ", canvas_x=" << get_canvas_x () << LF;
168-
show_completion_popup (tp, full_completions, cu, magf, get_scroll_x (),
169-
get_scroll_y (), get_canvas_x ());
137+
138+
array<string> full_completions;
139+
for (int i= 0; i < N (completions); ++i) {
140+
string c= completions[i];
141+
full_completions << (completion_prefix * c);
142+
}
143+
path tp1= tp;
144+
for (int i= 0; i < N (prefix); ++i) {
145+
tp1= previous_valid (et, tp1);
170146
}
147+
cursor cu= eb->find_check_cursor (tp1);
148+
show_completion_popup (tp, full_completions, cu, magf, get_scroll_x (),
149+
get_scroll_y (), get_canvas_x ());
171150

172151
set_arch_versioning (true);
173152
insert_tree (completions[0]);
174153

175154
if (get_input_mode () != INPUT_COMPLETE) {
176155
complete_et = copy (subtree (et, path_up (tp, 1)));
177156
complete_tp = copy (tp);
178-
complete_str= completions[0];
179157
}
180158
complete_message ();
181159
// beep ();
@@ -206,12 +184,6 @@ edit_interface_rep::complete_keypress (string key) {
206184
SERVER (set_completion_popup_visible (false));
207185
return false;
208186
}
209-
// else if (key == "backspace" && N(full_s) == 1) {
210-
// complete_str = string("");
211-
// set_input_normal ();
212-
// SERVER (set_completion_popup_visible (false));
213-
// return true;
214-
// }
215187
else if ((key != "tab") && (key != "S-tab") && (key != "up") &&
216188
(key != "down")) {
217189
cout << key << LF;
@@ -243,7 +215,6 @@ edit_interface_rep::complete_keypress (string key) {
243215
}
244216
if (completion_pos < 0) completion_pos= N (completions) - 1;
245217
if (completion_pos >= N (completions)) completion_pos= 0;
246-
complete_str= completions[completion_pos];
247218
new_s = completions[completion_pos];
248219

249220
remove (path_up (tp) * (end - N (old_s)), N (old_s));
@@ -321,7 +292,6 @@ edit_interface_rep::custom_complete (tree r) {
321292
// cout << prefix << ", " << compls << LF;
322293

323294
if ((prefix == "") || (N (compls) <= 1)) {
324-
complete_str= string ("");
325295
set_input_normal ();
326296
SERVER (set_completion_popup_visible (false));
327297
return;

src/Edit/Interface/edit_interface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ edit_interface_rep::operator tree () {
8787
void
8888
edit_interface_rep::suspend () {
8989
// cout << "Suspend " << buf->buf->name << LF;
90+
set_input_normal();
9091
if (got_focus) {
9192
interrupt_shortcut ();
9293
set_message ("", "", false);

src/Edit/Interface/edit_interface.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class edit_interface_rep : virtual public editor_rep {
3737
protected:
3838
tree complete_et;
3939
path complete_tp;
40-
string complete_str; // string to complete
4140
int env_change; // which things have been changed ?
4241
time_t last_change; // time of last processed change
4342
time_t last_update; // time of last update of menu, icons and footer

src/Edit/Interface/edit_keyboard.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ edit_interface_rep::set_input_mode (int mode) {
7070
void
7171
edit_interface_rep::set_input_normal () {
7272
cout << "set_input_normal\n";
73-
if (input_mode == INPUT_COMPLETE)
73+
if (input_mode == INPUT_COMPLETE){
74+
hide_completion_popup ();
7475
arch_reconstruct (complete_tp, complete_et, subtree (et, path_up (tp, 1)));
76+
}
7577
set_arch_versioning (false);
7678
set_input_mode (INPUT_NORMAL);
7779
}
@@ -231,7 +233,6 @@ edit_interface_rep::is_combo_shortcuts (string key) {
231233

232234
void
233235
edit_interface_rep::key_press (string gkey) {
234-
cout << "Key press: " << gkey << "\n";
235236
string zero= "a";
236237
zero[0] = '\0';
237238
string key = replace (gkey, "<#0>", zero);
@@ -312,7 +313,6 @@ edit_interface_rep::key_press (string gkey) {
312313
if (!inside_active_graphics ()) {
313314
archive_state ();
314315
call ("kbd-insert", rew);
315-
cout << "Inserted single character1: " << rew << "\n";
316316
if (get_input_mode () == INPUT_COMPLETE) {
317317
cout << "Exec delayed complete-try\n";
318318
// exec_delayed (scheme_cmd("(if (complete-try?) (noop))"));
@@ -324,7 +324,6 @@ edit_interface_rep::key_press (string gkey) {
324324
else if (contains_unicode_char (rew)) {
325325
archive_state ();
326326
call ("kbd-insert", key);
327-
cout << "Inserted single character2: " << rew << "\n";
328327
interrupt_shortcut ();
329328
}
330329
#ifdef Q_OS_MAC
@@ -339,13 +338,11 @@ edit_interface_rep::key_press (string gkey) {
339338
!inside_active_graphics ()) {
340339
archive_state ();
341340
call ("kbd-insert", "<" * key * ">");
342-
cout << "Inserted single character3: " << rew << "\n";
343341
interrupt_shortcut ();
344342
}
345343
else if (N (key) > 1 && !is_combo_shortcuts (key) && key != "escape") {
346344
archive_state ();
347345
call ("insert", key);
348-
cout << "Inserted single character4: " << rew << "\n";
349346
interrupt_shortcut ();
350347
}
351348
else {

src/Graphics/Gui/message.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,6 @@ set_scroll_position (widget w, SI x, SI y) {
509509
send<SI, SI> (w, SLOT_SCROLL_POSITION, x, y);
510510
}
511511

512-
inline void
513-
show_completion_popup (widget w, array<string>& completions, SI x, SI y) {
514-
send<array<string>, SI, SI> (w, SLOT_COMPLETION_LISTBOX_SHOW, completions, x,
515-
y);
516-
}
517-
518-
inline void
519-
get_completion_popup_visible (widget w, bool& visible) {
520-
query<bool> (w, SLOT_COMPLETION_LISTBOX_VISIBLE);
521-
}
522-
523512
inline void
524513
set_completion_popup_visible (widget w, bool visible) {
525514
send<bool> (w, SLOT_COMPLETION_LISTBOX_VISIBLE, visible);

src/Plugins/Qt/QTMCompletionPopup.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ QTMCompletionPopup::getCachedPosition (SI& x, SI& y) {
118118

119119
void
120120
QTMCompletionPopup::showComponent () {
121-
activateWindow ();
122121
// Ensure the listbox is visible
123-
// Force the widget to be on top
124-
setWindowFlags (windowFlags () | Qt::WindowStaysOnTopHint);
125122
raise ();
126123
show ();
127124
}
@@ -140,16 +137,17 @@ QTMCompletionPopup::focusOutEvent (QFocusEvent* event) {
140137
void
141138
QTMCompletionPopup::onItemClicked (QListWidgetItem* item) {
142139
if (item) {
143-
emit completionSelected (item->text ());
144140
SI end = last_item (cached_tp);
145141
string new_s= getSelectedText ();
146142
cout << "QTMCompletionPopup::onItemClicked: "
147143
<< "selected text: " << new_s << ", cached_tp: " << cached_tp
148144
<< ", end: " << end << ", lastSelectedText: " << lastSelectedText
149145
<< LF;
150-
remove (path_up (cached_tp) * (end - N (lastSelectedText)),
151-
N (lastSelectedText));
152-
insert (path_up (cached_tp) * (end - N (lastSelectedText)), new_s);
146+
//if (new_s != currentSelectedText) {
147+
remove (path_up (cached_tp) * (end - N (lastSelectedText)),
148+
N (lastSelectedText));
149+
insert (path_up (cached_tp) * (end - N (lastSelectedText)), new_s);
150+
//}
153151
widget w= widget (owner_widget);
154152
set_input_mode_normal (w);
155153
hide ();
@@ -234,7 +232,9 @@ QTMCompletionPopup::getText (SI idx) {
234232
void
235233
QTMCompletionPopup::onCurrentItemChanged (QListWidgetItem* current,
236234
QListWidgetItem* previous) {
237-
if (previous) {
235+
cout << "onCurrentItemChanged" << LF;
236+
if (previous)
238237
lastSelectedText= from_qstring (previous->text ());
239-
}
238+
if (current)
239+
currentSelectedText= from_qstring (current->text ());
240240
}

src/Plugins/Qt/QTMCompletionPopup.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class QTMCompletionPopup : public QListWidget {
2828
private:
2929
qt_simple_widget_rep* owner_widget; // for emiting messages
3030
string lastSelectedText;
31+
string currentSelectedText;
3132
path cached_tp;
3233

3334
protected:
@@ -71,9 +72,6 @@ class QTMCompletionPopup : public QListWidget {
7172
SI scroll_y, SI canvas_x, SI index);
7273
string getSelectedText ();
7374

74-
signals:
75-
void completionSelected (const QString& text);
76-
7775
protected:
7876
void keyPressEvent (QKeyEvent* event) override;
7977
void focusOutEvent (QFocusEvent* event) override;

src/Plugins/Qt/qt_simple_widget.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class qt_simple_widget_rep : public qt_widget_rep {
9090
QTMWidget* canvas () { return qobject_cast<QTMWidget*> (qwid); }
9191
QTMScrollView* scrollarea () { return qobject_cast<QTMScrollView*> (qwid); }
9292

93-
////////////////////// Completion listbox support
93+
////////////////////// Completion popup support
9494
// TODO: determine when to use slot and to use this routine
9595
void show_completion_popup (array<string>& completions, SI x, SI y);
9696
void show_completion_popup (path tp, array<string>& completions,

0 commit comments

Comments
 (0)