Re: GtkTextBuffer : Applying tags to newly input text

2018-06-21 Thread Gary Kramlich
The formats I need to handle are HTML and Markdown, while I could convert
them to Pango markup, it seems redundant to do so.  That said, I was
looking to be able to copy HTML back out from a buffer that's handling HTML
(by parsing it on insert).

I should note, as I haven't already, that my use case here is the input
widget for Pidgin an instant messaging client.  So some networks don't
support any formatting, some do HTML, and others do markdown.  So the way I
have this structured right now is that there's a text table with all the
tags, there's a text view that handles the wysiwyg stuff discussed
previously, and then there's an html buffer that parses the html in the
insert_text handler and applies the tags to that.  That said, I need both
the specific markup and the plain text for a number of scenarios.  So if
there's a way I can have the text view how to do additional parsing that is
mostly likely the direction I'll need to go.

Thanks,

--
Gary Kramlich 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTextBuffer : Applying tags to newly input text

2018-06-21 Thread Eric Cashon via gtk-app-devel-list


 
The textview understands Pango markup. Maybe something to give a try. There are 
a lot of text formats and you might have to do some text parsing depending on 
the format. If it is possible to use gtk_text_buffer_insert_markup(), this can 
save a lot of time dealing with text tags especially if you intend to print the 
text. It is far easier to send a pango markup string to print than to go 
through all the tags and draw them with cairo.

https://developer.gnome.org/pango/stable/PangoMarkupFormat.html

Eric

 


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: question about gtk_dialog (gtk2)

2018-06-21 Thread Emmanuele Bassi via gtk-app-devel-list
You haven't specified which windowing system you're using.

If it's X11, then the position of a window is always the remit of the
window manager; the position set is a hint, which is taken into account by
the window manager itself, alongside the "this is a dialog" hint that
GtkDialog sets.

There's no toolkit-available way to say "set this window to be at the
center of the screen", unless you create a GTK_WINDOW_POPUP and thus ask
the window manager to *not* manage your window.

Ciao,
 Emmanuele.


On Fri, 15 Jun 2018 at 12:44, Wojciech Puchar 
wrote:

> how to make dialogs appear on center of screen not on left corner. tried
> multiple things no results. For normal windows gtk_window_set_position
> works
>
> for dialog it doesn't
>
> below is example routine to ask a yes/no question from my program.
>
>
> i've tried
> gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);
>
> but it doesn't work
>
>
> nt pytanie(const char *txt) {
>   GtkWidget *dialog,*lab;
>   int odpowiedz;
>
> dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT,
>   TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
>   lab=new_label(txt);
>   gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area
> (GTK_DIALOG (dialog))), lab);
>   odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
>   gtk_widget_destroy(dialog);
>   return (odpowiedz==GTK_RESPONSE_ACCEPT);
> }
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>


-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: question about gtk_dialog (gtk2)

2018-06-21 Thread Matthew A. Postiff via gtk-app-devel-list

Hi,

I am learning about this, but have not totally figured it out. When I 
make a new assistant window, it appears in the upper left of the screen. 
Not at (0,0) but nearby.


  assistant = gtk_assistant_new();
  gtk_window_set_transient_for(GTK_WINDOW(assistant), transient_parent);
  gtk_window_set_title (GTK_WINDOW (assistant), title.c_str());
  gtk_window_set_modal (GTK_WINDOW (assistant), TRUE);
  //gtk_window_set_position (GTK_WINDOW(assistant), 
GTK_WIN_POS_CENTER_ON_PARENT);

  // the above line does not center the assistant
  gtk_window_set_destroy_with_parent(GTK_WINDOW(assistant), TRUE);

But the following kind of window IS centered:

  projectdialog = gtk_dialog_new();
  gtk_window_set_transient_for(GTK_WINDOW(projectdialog), 
transient_parent);

  gtk_window_set_title(GTK_WINDOW(projectdialog), _("Project properties"));
  //gtk_window_set_position(GTK_WINDOW(projectdialog), 
GTK_WIN_POS_CENTER_ON_PARENT);

  // the above doesn't matter...with or without, the dialog is centered
  gtk_window_set_modal(GTK_WINDOW(projectdialog), TRUE);
  gtk_window_set_type_hint(GTK_WINDOW(projectdialog), 
GDK_WINDOW_TYPE_HINT_DIALOG);


I don't understand it. Also, something in the gtk source code indicates 
that setting the position of a window centered can cause problems or 
doesn't work reliably, since it can "fight" with the window manager's 
preferred placement.


Anybody who knows what they are doing with this?


On 6/21/2018 2:00 AM, Wojciech Puchar wrote:

nobody have idea?


On 2018.06.15 13:43, Wojciech Puchar wrote:
how to make dialogs appear on center of screen not on left corner. 
tried multiple things no results. For normal windows 
gtk_window_set_position works


for dialog it doesn't

below is example routine to ask a yes/no question from my program.


i've tried 
gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);


but it doesn't work


nt pytanie(const char *txt) {
 GtkWidget *dialog,*lab;
 int odpowiedz;
 dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT, 


 TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
 lab=new_label(txt);
 gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area 
(GTK_DIALOG (dialog))), lab);

 odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
 gtk_widget_destroy(dialog);
 return (odpowiedz==GTK_RESPONSE_ACCEPT);
}



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: question about gtk_dialog (gtk2)

2018-06-21 Thread Wojciech Puchar

nobody have idea?


On 2018.06.15 13:43, Wojciech Puchar wrote:
how to make dialogs appear on center of screen not on left corner. 
tried multiple things no results. For normal windows 
gtk_window_set_position works


for dialog it doesn't

below is example routine to ask a yes/no question from my program.


i've tried 
gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);


but it doesn't work


nt pytanie(const char *txt) {
 GtkWidget *dialog,*lab;
 int odpowiedz;
 dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT, 


 TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
 lab=new_label(txt);
 gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area 
(GTK_DIALOG (dialog))), lab);

 odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
 gtk_widget_destroy(dialog);
 return (odpowiedz==GTK_RESPONSE_ACCEPT);
}



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list