Skip to content

Commit 589e794

Browse files
committed
remove ^C/^V in mainwindow
too annoying
1 parent 60fdc64 commit 589e794

File tree

4 files changed

+13
-127
lines changed

4 files changed

+13
-127
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- fix `to_colour`
99
- add `nip4-batch` batch mode interface
1010
- fix tests
11+
- remove ^C/^V in mainwindow
1112

1213
## 9.0.0-10 29025/02/18
1314

TODO

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
- open test.ws, edit defs, "main = 12;", process, ws is not marked as modified
1+
- add row label colour change for parent/child relationships
22

3-
- use main_log_add() consistently, print on exit
3+
- open test.ws, edit defs, "main = 12;", process, ws is not marked as modified
44

55
- check all batch mode flags
66

@@ -12,9 +12,6 @@
1212

1313
a limitation of gdk_texture_new_from_bytes()
1414

15-
- ^C / ^V copy-paste in mainwindow & program window is very annoying ...
16-
only add shortcuts in imagewindow
17-
1815
- use "propagate-natural-width" to get better fit of imageview window?
1916

2017
aim for max 600px on any axis

src/main-batch.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static gboolean main_option_test = FALSE;
3434
static char *main_option_prefix = NULL;
3535
static gboolean main_option_version = FALSE;
3636

37-
static iOpenFile *main_stdin = NULL;
37+
//static iOpenFile *main_stdin = NULL;
3838
static char *main_option_script = NULL;
3939
static char *main_option_expression = NULL;
4040
static gboolean main_option_stdin_ws = FALSE;
@@ -54,12 +54,11 @@ static GOptionEntry main_batch_options[] = {
5454
{ "version", 'v', 0, G_OPTION_ARG_NONE, &main_option_version,
5555
N_("print version number"), NULL },
5656

57+
// these options need testing and fixing
5758
{ "expression", 'e', 0, G_OPTION_ARG_STRING, &main_option_expression,
58-
N_("evaluate and print EXPRESSION"),
59-
"EXPRESSION" },
59+
N_("evaluate and print EXPRESSION"), "EXPRESSION" },
6060
{ "script", 's', 0, G_OPTION_ARG_FILENAME, &main_option_script,
61-
N_("load FILE as a set of definitions"),
62-
"FILE" },
61+
N_("load FILE as a set of definitions"), "FILE" },
6362
{ "set", '=', 0, G_OPTION_ARG_STRING_ARRAY, &main_option_set,
6463
N_("set values"), NULL },
6564
{ "verbose", 'V', 0, G_OPTION_ARG_NONE, &main_option_verbose,
@@ -69,8 +68,7 @@ static GOptionEntry main_batch_options[] = {
6968
{ "stdin-def", 'd', 0, G_OPTION_ARG_NONE, &main_option_stdin_def,
7069
N_("load stdin as a set of definitions"), NULL },
7170
{ "i18n", 'i', 0, G_OPTION_ARG_NONE, &main_option_i18n,
72-
N_("output strings for internationalisation"),
73-
NULL },
71+
N_("output strings for internationalisation"), NULL },
7472
{ NULL }
7573
};
7674

@@ -125,6 +123,9 @@ main_error_exit(const char *fmt, ...)
125123

126124
slist_map(expr_error_all, (SListMapFn) expr_error_print, &buf);
127125
fprintf(stderr, "%s", vips_buf_all(&buf));
126+
127+
if (!main_log_is_empty())
128+
fprintf(stderr, "%s", main_log_get());
128129
}
129130

130131
exit(1);

src/mainwindow.c

Lines changed: 2 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -160,35 +160,6 @@ mainwindow_dispose(GObject *object)
160160
G_OBJECT_CLASS(mainwindow_parent_class)->dispose(object);
161161
}
162162

163-
static void
164-
mainwindow_copy_action(GSimpleAction *action,
165-
GVariant *parameter, gpointer user_data)
166-
{
167-
printf("mainwindow_copy_action: FIXME\n");
168-
169-
/*
170-
Mainwindow *main = MAINWINDOW(user_data);
171-
172-
GdkClipboard *clipboard = gtk_widget_get_clipboard(GTK_WIDGET(win));
173-
g_autoptr(GFile) file = tilesource_get_file(tilesource);
174-
175-
VipsImage *image;
176-
177-
if (file)
178-
gdk_clipboard_set(clipboard, G_TYPE_FILE, file);
179-
else if ((image = tilesource_get_base_image(tilesource))) {
180-
g_autoptr(GdkTexture) texture = texture_new_from_image(image);
181-
182-
if (texture)
183-
gdk_clipboard_set(clipboard, GDK_TYPE_TEXTURE, texture);
184-
else
185-
imagewindow_error(win);
186-
}
187-
}
188-
189-
*/
190-
}
191-
192163
static gboolean
193164
mainwindow_open_workspace(Mainwindow *main, const char *filename)
194165
{
@@ -236,82 +207,13 @@ mainwindow_load_path(Mainwindow *main, const char *path)
236207
return TRUE;
237208
}
238209

210+
// used byworkspacegroupview.c for filename drop
239211
gboolean
240212
mainwindow_paste_filename(const char *filename, void *user_data)
241213
{
242-
return mainwindow_load_path(MAINWINDOW(user_data), filename);
243-
}
244-
245-
static void
246-
mainwindow_paste_action_ready(GObject *source_object,
247-
GAsyncResult *res, gpointer user_data)
248-
{
249-
GdkClipboard *clipboard = GDK_CLIPBOARD(source_object);
250214
Mainwindow *main = MAINWINDOW(user_data);
251215

252-
const GValue *value;
253-
GError *error = NULL;
254-
value = gdk_clipboard_read_value_finish(clipboard, res, &error);
255-
if (error) {
256-
error_top(_("Unable to paste"));
257-
error_sub("%s", error->message);
258-
g_error_free(error);
259-
mainwindow_error(main);
260-
}
261-
else if (value) {
262-
if (!value_to_filename(value, mainwindow_paste_filename, main))
263-
mainwindow_error(main);
264-
else
265-
symbol_recalculate_all();
266-
}
267-
}
268-
269-
/* GTypes we handle in copy/paste and drag/drop paste ... these are in the
270-
* order we try, so a GFile is preferred to a simple string.
271-
*
272-
* gnome file manager pastes as GdkFileList, GFile, gchararray
273-
* print-screen button pastes as GdkTexture, GdkPixbuf
274-
*
275-
* Created in _class_init(), since some of these types are only defined at
276-
* runtime.
277-
*/
278-
static GType *mainwindow_supported_types;
279-
static int mainwindow_n_supported_types;
280-
281-
static void
282-
mainwindow_paste_action(GSimpleAction *action,
283-
GVariant *parameter, gpointer user_data)
284-
{
285-
Mainwindow *main = MAINWINDOW(user_data);
286-
GdkClipboard *clipboard = gtk_widget_get_clipboard(GTK_WIDGET(main));
287-
288-
GdkContentFormats *formats = gdk_clipboard_get_formats(clipboard);
289-
gsize n_types;
290-
const GType *types = gdk_content_formats_get_gtypes(formats, &n_types);
291-
292-
#ifdef DEBUG
293-
printf("clipboard in %lu formats\n", n_types);
294-
for (gsize i = 0; i < n_types; i++)
295-
printf("%lu - %s\n", i, g_type_name(types[i]));
296-
#endif /*DEBUG*/
297-
298-
gboolean handled = FALSE;
299-
for (gsize i = 0; i < n_types; i++) {
300-
for (int j = 0; j < mainwindow_n_supported_types; j++)
301-
if (types[i] == mainwindow_supported_types[j]) {
302-
gdk_clipboard_read_value_async(clipboard,
303-
mainwindow_supported_types[j],
304-
G_PRIORITY_DEFAULT,
305-
NULL,
306-
mainwindow_paste_action_ready,
307-
main);
308-
handled = TRUE;
309-
break;
310-
}
311-
312-
if (handled)
313-
break;
314-
}
216+
return mainwindow_load_path(main, filename);
315217
}
316218

317219
static gboolean
@@ -665,8 +567,6 @@ mainwindow_keyboard_duplicate_action(GSimpleAction *action,
665567

666568
static GActionEntry mainwindow_entries[] = {
667569
// main window actions
668-
{ "copy", mainwindow_copy_action },
669-
{ "paste", mainwindow_paste_action },
670570

671571
{ "open", mainwindow_open_action },
672572
{ "merge", mainwindow_merge_action },
@@ -840,19 +740,6 @@ mainwindow_class_init(MainwindowClass *class)
840740

841741
BIND_CALLBACK(mainwindow_progress_cancel_clicked);
842742
BIND_CALLBACK(mainwindow_close_request);
843-
844-
GType supported_types[] = {
845-
GDK_TYPE_FILE_LIST,
846-
G_TYPE_FILE,
847-
GDK_TYPE_TEXTURE,
848-
G_TYPE_STRING,
849-
};
850-
851-
mainwindow_n_supported_types = VIPS_NUMBER(supported_types);
852-
mainwindow_supported_types =
853-
VIPS_ARRAY(NULL, mainwindow_n_supported_types + 1, GType);
854-
for (int i = 0; i < mainwindow_n_supported_types; i++)
855-
mainwindow_supported_types[i] = supported_types[i];
856743
}
857744

858745
static void

0 commit comments

Comments
 (0)