Making a cursor (cross hair) track between image displays

2012-04-02 Thread Tilton, James C. (GSFC-6063)
Hi GTK+ application developers!

I have developed an application using gtkmm in which I display related images 
in multiple Gtk::Window's.

I have two types of display images.  One is based on Gtk::Image and the other 
is based on Gtk::DrawingArea.
For the Gtk::Image case I add the Gtk::Image to a Gtk::EventBox, which in turn 
I add to a Gtk::ScrolledWindow.
For the Gtk::DrawingArea, is directly add the Gtk::DrawingArea to a 
Gtk::ScrolledWindow (without the intervening Gtk::EventBox).

When the image sizes exceed the ScrolledWindow display area, I use the 
Gtk::Adjustment associated with each Gtk::ScrolledWindow to have the 
pan-scrolling of each window track each other.

When I place the cursor in one of the display images, I would like to have a 
cross hair appear at the cursor location of the window in which the cursor is 
placed at the location currently pointed to by the cursor. I would ALSO like to 
have a similar cross hair appear in each of the other associated display images.

How can I make this happen with GTK+/gtkmm? I've looked for examples of this 
and haven't found any. Can anyone point me in the right direction for 
implementing this feature in my application?

(In my current application, the normal arrow cursor appears in just one window, 
and if I hold the either the left or right mouse button down, I have the column 
and row location and image data value(s) appear in text below the Scrolled 
Window image display.)

Thanks.

Jim Tilton

Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and 
http://science.gsfc.nasa.gov/606.3/TILTON/



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


need help with callback

2012-04-02 Thread Gary Kline
i hope you can help me get the largest function to print 
[via fprintf() --to a voiceconfile file-- the 

1) gender [M or F]
2) pitch
3) speed [of speech in words/minute]
4) volume [0 -- 200%]
5) delay [in 10th of a sec between words


originalyy, i thought coding this would be trivial.  it may
well be, but if so, i haven't figured it out!

this code will be on my options dropdown.  please see
http://www.thought.org/vbc for my latest pix.  --this is
entirely raw and unpolished; there are no links besides my
.signature.

the reason i am asking help is that my shoulder is giving
out  and i don't want to press my luck.  also because i am
still hard in Learn mode with gtk ... so this is one for you
gurus.

thanks for insights.. 

appended: dDemo.



===

/* from here:: Options callback */
#include gtk/gtk.h
#include string.h


enum 
{ 
  MALE, 
  FEMALE 
};

  /* globals */
  GtkWidget *gender_radio_male;
  GtkWidget *gender_radio_female;
  GtkWidget *pitch_scale1;
  GtkWidget *speedWPM_scale2;
  GtkWidget *volume_scale3;
  GtkWidget *delay_scale4;
  int valueGender, tgen = 0, tpit = 0, tspe = 0, tvol = 0, tdel =0;;
  double valuePitch, valueSpeed, valueVolume, valueDelay;
  /* end globals */


static void
cb_gender_toggled (GtkToggleButton *button, gpointer userdata)
{

puts(within callback);

  int malefemale = (int)userdata;

  if (gtk_toggle_button_get_active (button))
{
if (malefemale == MALE)
   {
fprintf(stdout, MALE [7]\n);
   }
else if (malefemale == FEMALE)
   {
fprintf(stdout, FEMALE  [13]\n);
   }
}
valueGender = malefemale;
}

static void hscale_value_changed_pitch (GtkRange *hscale, GtkWindow 
*parentWindow)
{
//fprintf(stderr,hscale pitch value: %g\n,value);
}

static void hscale_value_changed_speed (GtkRange *hscale, GtkWindow 
*parentWindow)
{
valueSpeed = gtk_range_get_value(hscale);
//fprintf(stderr,hscale speed value: %g\n,value);
}

static void hscale_value_changed_volume (GtkRange *hscale, GtkWindow 
*parentWindow)
{
valueVolume = gtk_range_get_value(hscale);
//fprintf(stderr,hscale volume value: %g\n,value);
}
static void hscale_value_changed_delay (GtkRange *hscale, GtkWindow 
*parentWindow)
{
valueDelay = gtk_range_get_value(hscale);
//fprintf(stderr,hscale delay value: %g\n,value);
}

int
main (int argc, char *argv[])
{
  /*
   * Declare the GTK Widgets used in the program
   */
  GtkWidget *dialog;
  GtkWidget *main_hbox;   //hbox1

  GtkWidget *gender_frame;
  GtkWidget *gender_align;
  GtkWidget *gender_hbox;  // hbox2
  /*
  GtkWidget *gender_radio_male;
  GtkWidget *gender_radio_female;
   */

  GtkWidget *params_frame;
  GtkWidget *params_align;

  GtkWidget *params_table;

  GtkWidget *temp_widget;
  GtkWidget *parent_window;

  /*
 Initialize GTK
   */
  gtk_init (argc, argv);


  parent_window = NULL; //Set to parent window if you want the dialog box
//to block access to the other windows in the app
//while it is open and running.


  dialog = gtk_dialog_new_with_buttons (Voice Settings, GTK_WINDOW 
(parent_window), 
0, 
GTK_STOCK_REVERT_TO_SAVED,  //revert button which
GTK_RESPONSE_CANCEL,//  returns a cancel response
GTK_STOCK_CLOSE,//close button which
GTK_RESPONSE_ACCEPT,//  returns an accept response
NULL// mark the end of our buttons (we could have 
more)
);

  gtk_window_set_title ( GTK_WINDOW ( dialog ) , VBC Espeak Options);
  gtk_widget_set_usize( GTK_WIDGET ( dialog ) , 600 , 400 );

  /*
   * dialog boxes have a vbox built in we can use 
   */
  main_hbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));

  /*
   * Create the first frame
   */
  gender_frame = gtk_frame_new (bVoice Gender/b);
  gtk_frame_set_shadow_type (GTK_FRAME (gender_frame), GTK_SHADOW_NONE);
  g_object_set (gtk_frame_get_label_widget (GTK_FRAME (gender_frame)),
use-markup, TRUE, NULL);
  gtk_widget_show (gender_frame);

  /*
   * ADD FRAME to the hbox 
   */
  gtk_box_pack_start (GTK_BOX (main_hbox), gender_frame, FALSE, FALSE, 0);//HBOX

  /*
   * Create an alignment widget to indent our child objects 
   */



  /*
   * left aligned, top-aligned, children should fill the box 
   */
  gender_align = gtk_alignment_new (0, 0, 0, 1);


  /*
   * set a left margin of 12 pixels :: Padding
   */
  gtk_alignment_set_padding (GTK_ALIGNMENT (gender_align), 0, 0, 12, 0);
  gtk_widget_show (gender_align);

  /*
   * add alignmnet widget to frame 
   */
  gtk_container_add (GTK_CONTAINER (gender_frame), gender_align);

  /*
   * Create a [vh]box for the radio buttons and add it to the
   * alignment widget inside the frame 
   */

  gender_hbox = gtk_hbox_new (FALSE, 2);//2