Exemplo n.º 1
0
void
cb_page_widget_scaled_button_release(ZathuraPage* page_widget, GdkEventButton* event,
    void* data)
{
  if (event->button != 1 || !(event->state & GDK_CONTROL_MASK)) {
    return;
  }

  zathura_t* zathura = data;

  bool synctex = false;
  girara_setting_get(zathura->ui.session, "synctex", &synctex);

  if (synctex == false) {
    return;
  }

  zathura_page_t* page = zathura_page_widget_get_page(page_widget);

  if (zathura->dbus != NULL) {
    zathura_dbus_edit(zathura->dbus, zathura_page_get_index(page), event->x, event->y);
  }

  char* editor = NULL;
  girara_setting_get(zathura->ui.session, "synctex-editor-command", &editor);
  if (editor == NULL || *editor == '\0') {
    g_free(editor);
    return;
  }

  synctex_edit(editor, page, event->x, event->y);
  g_free(editor);
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	int arg_index = 1;
	printf("This is SyncTeX command line utility, version 1.2\n");
	if(arg_index<argc) {
		if(0==strcmp("help",argv[arg_index])) {
			if(++arg_index<argc) {
				if(0==strcmp("view",argv[arg_index])) {
					synctex_help_view(NULL);
					return 0;
				} else if(0==strcmp("edit",argv[arg_index])) {
					synctex_help_edit(NULL);
					return 0;
				} else if(0==strcmp("update",argv[arg_index])) {
					synctex_help_update(NULL);
					return 0;
				}
			}
			synctex_help(NULL);
			return 0;
		} else if(0==strcmp("view",argv[arg_index])) {
			return synctex_view(argc-arg_index-1,argv+arg_index+1);
		} else if(0==strcmp("edit",argv[arg_index])) {
			return synctex_edit(argc-arg_index-1,argv+arg_index+1);
		} else if(0==strcmp("update",argv[arg_index])) {
			return synctex_update(argc-arg_index-1,argv+arg_index+1);
		} else if(0==strcmp("test",argv[arg_index])) {
			return synctex_test(argc-arg_index-1,argv+arg_index+1);
		}
	}
	synctex_help("Missing options");
	return 0;
}
Exemplo n.º 3
0
void
cb_page_widget_scaled_button_release(ZathuraPage* page_widget, GdkEventButton* event,
    void* data)
{
  zathura_t* zathura = data;

  zathura_page_t* page = zathura_page_widget_get_page(page_widget);

  /* set page number (but don't scroll there. it was clicked on, so it's visible) */
  if (event->button == GDK_BUTTON_PRIMARY) {
    zathura_document_set_current_page_number(zathura->document, zathura_page_get_index(page));
    refresh_view(zathura);
  }

  if (event->button != GDK_BUTTON_PRIMARY || !(event->state & GDK_CONTROL_MASK)) {
    return;
  }

  bool synctex = false;
  girara_setting_get(zathura->ui.session, "synctex", &synctex);
  if (synctex == false) {
    return;
  }

  if (zathura->dbus != NULL) {
    zathura_dbus_edit(zathura->dbus, zathura_page_get_index(page), event->x, event->y);
  }

  char* editor = NULL;
  girara_setting_get(zathura->ui.session, "synctex-editor-command", &editor);
  if (editor == NULL || *editor == '\0') {
    girara_debug("No SyncTeX editor specified.");
    g_free(editor);
    return;
  }

  synctex_edit(editor, page, event->x, event->y);
  g_free(editor);
}