////////////////////////////////////Fonctions clavier déplacées en fonction indépendantes pour mapping/////////////////////////
int key_switch_window_up()
{
//solo des fenetres
if (key_shifts & KB_CTRL_FLAG || index_false_control==1) //appel une par une

{
pos_focus_window=window_focus_id;
substract_a_window(pos_focus_window);
if(pos_focus_window<900){pos_focus_window=899;}
pos_focus_window++;
if(pos_focus_window>max_window_identity_is){pos_focus_window=900;}
add_a_window(pos_focus_window);
}

else//passage dune fenetre à l autre
{
index_to_navigate_between_window++;
nbre_fenetre_actives=check_nbre_opened_windows();
if(index_to_navigate_between_window>=nbre_fenetre_actives+1){index_to_navigate_between_window=0;}
if(window_opened[index_to_navigate_between_window]>0)
{
window_bring_to_front(window_opened[index_to_navigate_between_window]);
}
else {window_bring_to_front(window_opened[0]);   }
}
 return(0);
}
int key_unselect_ch()
{
reset_numeric_entry();

//if ((key_shifts & KB_SHIFT_FLAG  || index_false_shift==1))
if(key[KEY_LSHIFT]|| index_false_shift==1)
{
             if( index_patch_window==1 && index_ask_confirm==0)
             {
             patch_unselect_all_dimmers();
             strcpy(string_monitor_patch,"");
             index_patch_affect_is_done=0;
             }
}


else
{

             for (int ci=1;ci<514;ci++)
             {Selected_Channel[ci]=0;}
             last_ch_selected=0;
             index_type=0;index_level_attribue=0;
             substract_channel_selection_to_layers_plot();


             if(index_ask_confirm==1)
             {
             reset_indexs_confirmation();
             reset_index_actions();
             substract_a_window(W_ASKCONFIRM);
             window_focus_id=previous_window_focus_id;
             add_a_window(window_focus_id);
             }
}

return(0);
}
Exemplo n.º 3
0
void pressed_shifter()
{
	GtkWidget *vbox, *hbox, *table, *button, *label;
	GtkAccelGroup* ag = gtk_accel_group_new();
	int i, j, max;
	char txt[32];


	shifter_window = add_a_window(GTK_WINDOW_TOPLEVEL, _("Palette Shifter"),
		GTK_WIN_POS_CENTER, TRUE);
	vbox = add_vbox(shifter_window);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);

	table = add_a_table(9, 4, 5, vbox);

	label = add_to_table( _("Start"),  table, 0, 1, 1 );
	gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 );
	label = add_to_table( _("Finish"), table, 0, 2, 1 );
	gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 );
	label = add_to_table( _("Delay"),  table, 0, 3, 1 );
	gtk_misc_set_alignment( GTK_MISC(label), 0.5, 0.5 );

	for ( i=0; i<8; i++ )
	{
		sprintf(txt, "%i", i);
		add_to_table( txt, table, i+1, 0, 5 );

		for ( j=0; j<3; j++ )
		{
			if ( j==2 ) max=255; else max=mem_cols-1;
			shifter_spin[i][j] = spin_to_table( table, i+1, j+1, 2,
						shifter_in[i][j], 0, max );
			spin_connect(shifter_spin[i][j],
				GTK_SIGNAL_FUNC(shifter_moved), NULL);
		}
	}


	hbox = pack(vbox, gtk_hbox_new(FALSE, 0));
	gtk_widget_show (hbox);

	button = pack(hbox, sig_toggle_button(_("Play"), FALSE, NULL,
		GTK_SIGNAL_FUNC(shift_but_playstop)));
	shift_play_state = FALSE;			// Stopped

	shifter_label = xpack(hbox, gtk_label_new(""));
	gtk_widget_show( shifter_label );
	gtk_misc_set_alignment( GTK_MISC(shifter_label), 0.5, 0.5 );


	shifter_slider = xpack5(vbox, mt_spinslide_new(-1, -1));
	mt_spinslide_set_range(shifter_slider, 0, 0);
	mt_spinslide_set_value(shifter_slider, 0);
	mt_spinslide_connect(shifter_slider, GTK_SIGNAL_FUNC(shifter_slider_moved), NULL);


	add_hseparator( vbox, -2, 10 );

	hbox = pack(vbox, gtk_hbox_new(FALSE, 0));
	gtk_widget_show (hbox);

	button = xpack5(hbox, gtk_button_new_with_label(_("Clear")));
	gtk_widget_show(button);
	gtk_signal_connect(GTK_OBJECT(button), "clicked",
		GTK_SIGNAL_FUNC(click_shift_clear), NULL);

	button = xpack5(hbox, gtk_button_new_with_label(_("Fix Palette")));
	gtk_widget_show(button);
	gtk_signal_connect(GTK_OBJECT(button), "clicked",
		GTK_SIGNAL_FUNC(click_shift_fix), NULL);

	button = xpack5(hbox, gtk_button_new_with_label(_("Create Frames")));
	gtk_widget_show(button);
	gtk_signal_connect(GTK_OBJECT(button), "clicked",
		GTK_SIGNAL_FUNC(click_shift_create), NULL);

	button = xpack5(hbox, gtk_button_new_with_label(_("Close")));
	gtk_widget_show(button);
	gtk_signal_connect(GTK_OBJECT(button), "clicked",
		GTK_SIGNAL_FUNC(click_shift_close), NULL );
	gtk_widget_add_accelerator (button, "clicked", ag, GDK_Escape, 0, (GtkAccelFlags) 0);
	delete_to_click(shifter_window, button);

	gtk_window_add_accel_group(GTK_WINDOW (shifter_window), ag);
// !!! Transient windows cannot be minimized; don't know if that's desirable here
//	gtk_window_set_transient_for(GTK_WINDOW(shifter_window), GTK_WINDOW(main_window));
	gtk_widget_show(shifter_window);

#if GTK_MAJOR_VERSION == 1
	gtk_widget_queue_resize(shifter_window); /* Re-render sliders */
#endif

	mem_pal_copy( sh_old_pal, mem_pal );			// Backup the current palette
	shifter_pos = 0;
	shifter_max = 0;
	shifter_moved();					// Initialize the input array
}
int commandes_clavier()//la fonction sprintf tue l acces clavier
{
if ( keypressed())
{

int chi = readkey(); 
scan_ascii_is=(chi & 0xff);//prend pas en compte touches fonctions
scan_allegro_key_is=(chi >> 8);//prend en compte tout le monde mais à redistribuer fr et anglais


switch (chi >> 8)  
{	
    

case KEY_ESC://nettoyage chaine de caractere et deselection totale

reset_indexs_confirmation();
reset_index_actions();
key_unselect_ch();
if(window_focus_id==W_PLOT )
{
if(index_menus_lighting_plot==1) unselect_all_shapes();
else if( index_menus_lighting_plot==2 || index_menus_lighting_plot==4)
{reset_symbols_selected(view_plot_calc_number_is);}
}
else if(window_focus_id==W_ASKCONFIRM)
{
 substract_a_window(W_ASKCONFIRM);
 substract_a_window(previous_window_focus_id);
 mouse_released=1;
 window_focus_id=previous_window_focus_id;
 add_a_window(window_focus_id);      
}
sprintf(string_key_id,list_keyname[9]);
break;

///////////////////////PAGE UP DOWN POUR FENETRES /////////////////////////////
case KEY_PGUP: 
sprintf(string_key_id,list_keyname[0]);
key_switch_window_up();
break; 
case KEY_PGDN: 
sprintf(string_key_id,list_keyname[0]);
key_switch_window_down();
break; 
//////////////////SPECIAL KEYS ////////////////////////////////////////////////
case  KEY_TILDE://carré
if(window_focus_id==W_PLOT) {index_move_plot_view_port=toggle(index_move_plot_view_port);}
break;

case KEY_F1://dock mode
if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_overrecord_mem=1;
clear_keybuf();

}
else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
{
int mem_to_rec=(int)(atof(numeric)*10);

reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_create_mem=1;
}
else
{
index_do_report=0;
index_do_modify=0; 
index_main_clear=0;
index_do_dock=toggle(index_do_dock);

switch (window_focus_id)
{
case W_CHASERS:
index_affect_chaser_to_dock=index_do_dock;
break;   
case W_GRID:
for(int i=0;i<4;i++)
{
if(index_show_grid_player[i]==1)
{
gridplayer_to_affect_is=i; break;
}
}
break;
case W_MOVER:
index_affect_to_dock_mover=index_do_dock;     
break;    
case W_DRAW:
index_affect_draw_to_dock=index_do_dock;
break;
case W_ECHO:
index_affect_echo_to_dock=index_do_dock;
break;
case W_TIME:
index_affect_time=index_do_dock;   
break;
case W_TRACKINGVIDEO:
index_affect_video_tracking_to_dock=index_do_dock; 
break;
case W_TRICHROMY:
index_affect_color_to_dock=index_do_dock; 
break;
case W_AUDIO:
index_affect_audio_to_dock=index_do_dock;
player_to_affect_to_dock=0;
audio_type_for_dock_affectation_is=0;
break;
case W_CFGMENU:
if(config_page_is==1) { index_affect_dmxin=index_do_dock; }
else if(config_page_is==3) {index_do_affect_net_to_dock=index_do_dock; } 
break;
default:
break;      
}

}
break;
      
case KEY_F2:
index_do_dock=0;
index_do_report=0;
index_main_clear=0;
index_do_modify=toggle(index_do_modify);;      
break;      

case KEY_F3:
if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=1;
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_overecord_mem_plus_faders=1;               
}     
else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) //creation mémoires en mode merge Faders / seq
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=1;
int mem_to_rec=(int)(atof(numeric)*10);
reset_indexs_confirmation();
index_ask_confirm=1; 
index_do_create_mem_plus_faders=1;
}
else
{
index_do_dock=0;
index_do_modify=0; 
index_main_clear=0;
index_do_report=toggle(index_do_report); 
}
break;  

case KEY_F4:
index_do_dock=0;
index_do_modify=0; 
index_do_report=0;     
index_main_clear=toggle(index_main_clear);
break;  

case KEY_F5:
              index_type=toggle(index_type);
              sprintf(numeric,"");numeric_postext=0;
break; 

case KEY_F6:
         if(index_time==0){add_a_window(W_TIME);  } 
           else {   substract_a_window(W_TIME); }
break;  

case KEY_F7:
if(index_trichro_window==0){add_a_window(W_TRICHROMY);} 
else  { substract_a_window(W_TRICHROMY);  }
break;  

case KEY_F8:
  if(index_video_window==0){ add_a_window(W_TRACKINGVIDEO); } 
 else{ substract_a_window(W_TRACKINGVIDEO);}
break;  

case KEY_F9:
          if(index_window_sequentiel==0){;add_a_window(W_SEQUENCIEL);}
          else {substract_a_window(W_SEQUENCIEL);}
break;
case KEY_F10:
if (key_shifts & KB_SHIFT_FLAG  || index_false_shift==1) //CONFIG
{
if(index_show_minifaders==0){add_a_window(W_MINIFADERS);}
else {substract_a_window(W_MINIFADERS);}
}
else
{
if(index_show_faders==0){add_a_window(W_FADERS);}
else {substract_a_window(W_FADERS);}
}

break;  

case KEY_F11:
if (key_shifts & KB_SHIFT_FLAG  || index_false_shift==1) //CONFIG
{
if(index_show_config_window==0){add_a_window(W_CFGMENU);}
else {substract_a_window(W_CFGMENU);}     
}
else if (key_shifts & KB_CTRL_FLAG  || index_false_control==1 ) 
{index_blind=toggle(index_blind);   }
else
{
if(index_show_banger_window==0)
          {add_a_window(W_BANGER);mouse_level_for_event=mouse_z;mouse_level_for_banger=mouse_z;}
          else {substract_a_window(W_BANGER);}       
}
break;  
              
case KEY_F12://black out

if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
{
index_ask_confirm=1;index_do_quit_with_save=1;
}

else if (key_shifts & KB_SHIFT_FLAG   || index_false_shift==1) 
{
for (int i=0;i<12;i++)
{
specify_who_to_save_load[i]=0;}
reset_save_load_report_string();     
index_ask_confirm=1;index_do_quit_without_save=1;
}

else
{
if(index_blind==0)
{
for (int rs=0;rs<513;rs++)
{bufferSaisie[rs]=0;Selected_Channel[rs]=0;   }   
sprintf(string_Last_Order,">> Black Out done for On Stage channels");      
}     
else if(index_blind==1)
{
for (int rs=0;rs<513;rs++)
{bufferBlind[rs]=0; Selected_Channel[rs]=0;   }    
sprintf(string_Last_Order,">> Black Out done for On Blind channels");                       
}
             
substract_channel_selection_to_layers_plot();
}  
break;    


case KEY_UP:
key_up();
sprintf(string_key_id,list_keyname[1]);
break;

case KEY_DOWN:
key_down();
sprintf(string_key_id,list_keyname[2]);
break;

case KEY_ENTER :
key_affectation();
sprintf(string_key_id,list_keyname[3]);
break; 

case KEY_ENTER_PAD:
key_affectation();
sprintf(string_key_id,list_keyname[4]);
break; 

case KEY_EQUALS://+
key_add_ch();
sprintf(string_key_id,list_keyname[5]);
break;

case KEY_PLUS_PAD://+ num
key_add_ch();
sprintf(string_key_id,list_keyname[6]);
break;

case KEY_MINUS://-
key_minus_ch();
sprintf(string_key_id,list_keyname[7]);
break;

case KEY_MINUS_PAD://- num
key_minus_ch();
sprintf(string_key_id,list_keyname[8]);
break;


case KEY_TAB:
if(numeric_postext>0)
{
key_thruth();
sprintf(string_key_id,list_keyname[10]);
}
else 
{
if(window_focus_id==W_PLOT) {index_tab_on=toggle(index_tab_on); }  
}
break;
////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////TEXT TYPING OR FUNCTIONS CALLING//////////////////////////////////////////

case KEY_SPACE: 
              if (index_type==0)
             {
             key_go();
             }
              else if(index_type==1)
             {
             numeric[numeric_postext]=' ';
             numeric_postext++;
             }
       sprintf(string_key_id,list_keyname[11]);
       break;
             
         

        case KEY_Q: //lettre a
        if (key_shifts & KB_CTRL_FLAG  || index_false_control==1)
        {
        if(index_show_audio_window==0){add_a_window(W_AUDIO);}
        else {substract_a_window(W_AUDIO);}
        reset_audio_indexs_to_dock();       
        }
        else 
        {

             if(index_type==0)
             {
             key_presetvideo(0);
             }
             else  if (index_type==1)
             {
             numeric[numeric_postext]='A';
             numeric_postext++;
             }
         }
         sprintf(string_key_id,list_keyname[12]);
         break;  
       case KEY_B:
           if (index_type==0)
           {
           key_roi(10);
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='B';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[13]);
           break;
           
        case KEY_C:
            if (index_type==0)
           { 
            if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
            {
            if(numeric_postext==0)
            {
            channel_copy();
            }
            else
            {
            snap_mem_to_copy();  
            }
            } 
            else  if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
            {
            if(index_window_chasers==0){add_a_window(W_CHASERS);} 
            else {substract_a_window(W_CHASERS);}
            } 
           else
           {
           key_roi(8);         }
           } 
           else if (index_type==1)
           {
           numeric[numeric_postext]='C';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[14]);
           break;
           
        case KEY_D://dock mode on
           if(index_type==0)
           {
            key_roi(2);
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='D';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[15]);
           break;
           
        case KEY_E:
            if (index_type==0)
           {
           key_presetvideo(2);
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='E';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[16]);
           break;
           
        case KEY_F:
           if(index_type==0)
           {
           key_roi(3);
           }
           
           else if (index_type==1)
           {
           numeric[numeric_postext]='F';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[17]);
           break;
           
        case KEY_G:
            if (index_type==0)
           {
           if ((key_shifts & KB_CTRL_FLAG || index_false_control==1 ) && numeric_postext>0)
           {
           //GET CHANNELS FROM A MEMORY     
           int mem_to_take=(int)(atof(numeric)*10);
           if(MemoiresExistantes[mem_to_take]==1)
           {
           Get_channels_from_memory(mem_to_take);  
           }
           else {sprintf(string_Last_Order,"Get Sel. channel from %d.%d: mem doesn't exist",mem_to_take/10,mem_to_take%10);}   
           } 
           else {key_roi(4);}
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='G';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[18]);
           break;
           
           case KEY_H:

            if (index_type==0)
           {
           key_roi(5);   
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='H';
           numeric_postext++;
           }
           
           sprintf(string_key_id,list_keyname[19]);
           break;
        
        case KEY_I:    
           if(index_type==0) //full
           {
           key_full();
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='I';
           numeric_postext++;
           }
         sprintf(string_key_id,list_keyname[20]);
           break;
           
        case KEY_J:
           if (index_type==0)
           {
           key_time_out();
           }        
           if (index_type==1)
           {
           numeric[numeric_postext]='J';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[21]);
           break;
           
        case KEY_K:
            if (index_type==0)
           {
           key_time_in();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='K';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[22]);
           break;
           
        case KEY_L://in + out
           if(index_type==0)
           {
           key_time_in_out();
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='L';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[23]);
           break;
        
        case KEY_SEMICOLON:
           if(index_type==0)//le M qui est point en clavier americain
           {
           if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
           { if(index_show_mover_window=0){add_a_window(W_MOVER);}
           else {substract_a_window(W_MOVER);}}
           }
           else if(index_type==1)
           {
           numeric[numeric_postext]='M';
           numeric_postext++;     
           }
           sprintf(string_key_id,list_keyname[38]);
           break;  
                
        case KEY_N:
           if (index_type==0)
           {
           key_roi(11);          
           } 
           else if (index_type==1)
           {
           numeric[numeric_postext]='N';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[24]);
           break;
           
        case KEY_O:
       
         
           if(index_type==0)
           { 
           key_at_zero();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='O';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[25]);
           break;
           
        case KEY_P:

          if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
           {
           if(index_patch_window==0){add_a_window(W_PATCH);}
           else {substract_a_window(W_PATCH);} 
           } 
           else{
           if (index_type==0)
           {
             if(index_visual_pad==0){add_a_window(W_NUMPAD);}
             else {substract_a_window(W_NUMPAD);}  
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='P';
           numeric_postext++;
           }
           }
           sprintf(string_key_id,list_keyname[39]);
           break;

        case KEY_A: // lettre Q
            if (index_type==0)
           {
           key_roi(1);
            }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Q';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[26]);
           break;        
  
        case KEY_R://report mode on
        if(index_type==0 )
        {
        key_presetvideo(3);;//les banques de tracking cam
        }
        else if(index_type==1)
        {
           numeric[numeric_postext]='R';
           numeric_postext++;
        }
        sprintf(string_key_id,list_keyname[27]);
           break;
           
        case KEY_S:
            if (index_type==0)
           {
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
           {
           if(index_is_saving==0){index_save_global_is=1;index_do_quick_save=1;}
           }
           else
           {
           key_roi(1);
           }
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='S';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[28]);
           break;
           
       case KEY_T:
           if(index_type==0)
           {
           key_presetvideo(4);//les banques de tracking cam
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='T';
           numeric_postext++;
           }         
           sprintf(string_key_id,list_keyname[29]);
           break;
           
        case KEY_U://inverse selection
           if (index_type==0)
           {
           key_select_inv();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='U';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[30]);
           break;
           
        case KEY_V:
           if (index_type==0)
           {
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1) 
           {
           if(numeric_postext==0)
            {
            channel_paste();
            }
            else//si chiffre de mem tapée
            {
            index_copy_mem_in=1; 
            index_ask_confirm=1;
            
            }              
           } 
           else
           {
           //les aires de tracking cam
           key_roi(9);
           }
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='V';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[31]);
           break;
           
        case KEY_Z://w
           if (index_type==0)
           {
           if(key_shifts )
           {
           key_backward();
           }
           else{//les aires de tracking cam
           key_roi(6);
           }        
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='W';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[32]);
           break;
           
        case KEY_X:
           if (index_type==0)
           {
           if(key_shifts)
           {
           key_forward();
           }
          
           else{//les aires de tracking cam
           key_roi(7);
           }
           }
           else  if (index_type==1)
           {
           numeric[numeric_postext]='X';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[33]);
           break;
           
        case KEY_Y://select all 
          
          if (index_type==0)
           {
          key_select_all();
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Y';
           numeric_postext++;
           }
           sprintf(string_key_id,list_keyname[34]);
           break;
           
        case KEY_W://z
           if (key_shifts & KB_CTRL_FLAG  || index_false_control==1)
             {
             //ctrl Z reload mem as recorded
             index_do_reload_mem=1;
             index_ask_confirm=1;                   
             }
             else if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1)
             {
             //ctrl Z resurrect mem as recorded
             mem_to_resurrect=(int)(atof(numeric)*10);   
             index_do_resurrect_mem=1;  
             index_ask_confirm=1;                            
             }
           else
           {
            if (index_type==0 )
           {
           key_presetvideo(1);//les banques de tracking cam
           }
           else if (index_type==1)
           {
           numeric[numeric_postext]='Z';
           numeric_postext++;
           }
           }
           sprintf(string_key_id,list_keyname[35]);
           break;
           
    case KEY_LEFT:
    key_left(); 
    sprintf(string_key_id,list_keyname[36]);
    break;
       
       case KEY_RIGHT:
       key_right();
       sprintf(string_key_id,list_keyname[37]);
       break;
      
      case KEY_DEL:
      if (key_shifts & KB_SHIFT_FLAG || index_false_shift==1) 
      {
      reset_indexs_confirmation(); 
      index_do_delete_mem=1;  
      index_ask_confirm=1;       
      }
      break;
//////////////////////ENTREES NUMERIQUES COMMUNES//////////////////////////////////////////

case KEY_0:
numeric[numeric_postext]='0';
numeric_postext++;
break;
case KEY_0_PAD:
numeric[numeric_postext]='0';
numeric_postext++;
break;
case KEY_1:
numeric[numeric_postext]='1';
numeric_postext++;
break;
case KEY_1_PAD:
numeric[numeric_postext]='1';
numeric_postext++;
break;

case KEY_2:
numeric[numeric_postext]='2';
numeric_postext++;
break;
case KEY_2_PAD:
numeric[numeric_postext]='2';
numeric_postext++;
break;
case KEY_3:
numeric[numeric_postext]='3';
numeric_postext++;
break;
case KEY_3_PAD:
numeric[numeric_postext]='3';
numeric_postext++;
break;
case KEY_4:
numeric[numeric_postext]='4';
numeric_postext++;
break;
case KEY_4_PAD:
numeric[numeric_postext]='4';
numeric_postext++;
break;
case KEY_5:
numeric[numeric_postext]='5';
numeric_postext++;
break;
case KEY_5_PAD:
numeric[numeric_postext]='5';
numeric_postext++;
break;
case KEY_6:
numeric[numeric_postext]='6';
numeric_postext++;
break;
case KEY_6_PAD:
numeric[numeric_postext]='6';
numeric_postext++;
break;
case KEY_7:
numeric[numeric_postext]='7';
numeric_postext++;
break;
case KEY_7_PAD:
numeric[numeric_postext]='7';
numeric_postext++;
break;
case KEY_8:
numeric[numeric_postext]='8';
numeric_postext++;
break;
case KEY_8_PAD:
numeric[numeric_postext]='8';
numeric_postext++;
break;
case KEY_9:
numeric[numeric_postext]='9';
numeric_postext++;
break;
case KEY_9_PAD:
numeric[numeric_postext]='9';
numeric_postext++;
break;   

case KEY_COMMA:
numeric[numeric_postext]='.';
numeric_postext++;
break;

case  KEY_DEL_PAD:
numeric[numeric_postext]='.';
numeric_postext++;
break;

case  KEY_M:
numeric[numeric_postext]='.';
numeric_postext++;
break;


case KEY_BACKSPACE:
numeric[numeric_postext]=' ';
numeric_postext--;
numeric[numeric_postext]=' ';
if (numeric_postext<0) {numeric_postext=0;}
break;   

////////////////////MISE EN MEMOIRES DES FENETRES ET TOGGLE/////////////////////
case KEY_PRTSCR:
key_printscreen();              
break; 

default:
      
break;
}  
for(int u=0;u<nbre_key_persos;u++)
{
//keys persos
if( (int)(chi & 0xff)==mapping_temporaire[u])
{
switch(u)
{
case 0://AT level
key_affectation();
sprintf(string_key_id,"At Level");//max 16 char
break;
case 1://CH+
key_add_ch();
sprintf(string_key_id,"Ch +");//max 16 char
break;
case 2://CH-
key_minus_ch();
sprintf(string_key_id,"Ch -");//max 16 char     
break;
case 3://CH THRUTH
key_thruth();
sprintf(string_key_id,"To Ch");//max 16 char     
break;
case 4://CLEAR
key_unselect_ch();
sprintf(string_key_id,"Clear");//max 16 char        
break;
default:
break;
}
}
}



   
//protections

if (numeric_postext>maxchar_numeric){numeric[numeric_postext]=' ';numeric_postext=maxchar_numeric-1;}

if (numeric_postext<0) {numeric_postext=0;} 


       
}
sprintf(string_numeric_entry,"<< %s",numeric);


//CTRL-S
if(index_do_quick_save==1 )
      {
      Save_Show();
      sprintf(string_Last_Order,">> Show Saved at %s", tmp_time);
      index_do_quick_save=0;
      }
      
poll_keyboard();
      
return(0);  
}
Exemplo n.º 5
0
void pressed_preferences( GtkMenuItem *menu_item, gpointer user_data )
{
	int i;
#ifdef U_NLS
	int j;
	GSList *radio_group;
#endif


	GtkWidget *vbox3, *hbox4, *table3, *table4, *table5, *drawingarea_tablet, *frame;
	GtkWidget *button1, *button2, *notebook1, *vbox_1, *vbox_2, *vbox_3, *label;
	GtkAccelGroup* ag = gtk_accel_group_new();

	char *tab_tex[] = { _("Max memory used for undo (MB)"), _("Greyscale backdrop"),
		_("Selection nudge pixels"), _("Max Pan Window Size") };
	char *tab_tex2[] = { _("XPM/PNG transparency index"), _("XBM X hotspot"), _("XBM Y hotspot"),
		_("JPEG Save Quality (100=High)   "), _("Recently Used Files") };
	char *tab_tex3[] = { _("Minimum grid zoom"), _("Grid colour RGB") };
	char *stat_tex[] = { _("Colour A & B"), _("Canvas Geometry"), _("Cursor X,Y"),
		_("Pixel [I] {RGB}"), _("Zoom %"), _("Selection Geometry"), _("Continuous Mode"),
		_("Undo / Redo"), _("Opacity %"), _("Opacity Mode") },
		*tablet_txt[] = { _("Size"), _("Flow"), _("Opacity") };
	char txt[64];


	men_item_state( menu_prefs, FALSE );	// Make sure the user can only open 1 prefs window

	prefs_window = add_a_window( GTK_WINDOW_TOPLEVEL, _("Preferences"), GTK_WIN_POS_CENTER, FALSE );

	vbox3 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox3);
	gtk_container_add (GTK_CONTAINER (prefs_window), vbox3);

///	SETUP NOTEBOOK

	notebook1 = gtk_notebook_new ();
	gtk_box_pack_start (GTK_BOX (vbox3), notebook1, TRUE, TRUE, 0);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook1), GTK_POS_TOP);
	gtk_widget_show (notebook1);

///	---- TAB1 - GENERAL

	vbox_1 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_1);
	gtk_container_add (GTK_CONTAINER (notebook1), vbox_1);

	label = gtk_label_new( _("General") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label);


	table3 = add_a_table( 3, 2, 10, vbox_1 );

///	TABLE TEXT
	for ( i=0; i<4; i++ ) add_to_table( tab_tex[i], table3, i, 0, 0, GTK_JUSTIFY_LEFT, 0, 0.5 );

///	TABLE SPINBUTTONS
	spin_to_table( table3, &spinbutton_maxmem, 0, 1, 5, inifile_get_gint32("undoMBlimit", 32 ), 1, 1000 );
	spin_to_table( table3, &spinbutton_greys, 1, 1, 5, inifile_get_gint32("backgroundGrey", 180 ), 0, 255 );
	spin_to_table( table3, &spinbutton_nudge, 2, 1, 5, inifile_get_gint32("pixelNudge", 8 ), 2, 512 );
	spin_to_table( table3, &spinbutton_pan, 3, 1, 5, inifile_get_gint32("panSize", 128 ), 64, 256 );

	checkbutton_paste = add_a_toggle( _("Display clipboard while pasting"),
		vbox_1, inifile_get_gboolean("pasteToggle", TRUE) );
	checkbutton_cursor = add_a_toggle( _("Mouse cursor = Tool"),
		vbox_1, inifile_get_gboolean("cursorToggle", TRUE) );
	checkbutton_exit = add_a_toggle( _("Confirm Exit"),
		vbox_1, inifile_get_gboolean("exitToggle", FALSE) );
	checkbutton_quit = add_a_toggle( _("Q key quits mtPaint"),
		vbox_1, inifile_get_gboolean("quitToggle", TRUE) );
	checkbutton_commit = add_a_toggle( _("Changing tool commits paste"),
		vbox_1, inifile_get_gboolean("pasteCommit", FALSE) );


///	---- TAB2 - FILES

	vbox_2 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_2);
	gtk_container_add (GTK_CONTAINER (notebook1), vbox_2);

	label = gtk_label_new( _("Files") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label);

	table4 = add_a_table( 5, 2, 10, vbox_2 );

	for ( i=0; i<5; i++ ) add_to_table( tab_tex2[i], table4, i, 0, 0, GTK_JUSTIFY_LEFT, 0, 0.5 );

	spin_to_table( table4, &spinbutton_trans, 0, 1, 5, mem_xpm_trans, -1, mem_cols-1 );
	spin_to_table( table4, &spinbutton_hotx, 1, 1, 5, mem_xbm_hot_x, -1, mem_width-1 );
	spin_to_table( table4, &spinbutton_hoty, 2, 1, 5, mem_xbm_hot_y, -1, mem_height-1 );
	spin_to_table( table4, &spinbutton_jpeg, 3, 1, 5, mem_jpeg_quality, 0, 100 );
	spin_to_table( table4, &spinbutton_recent, 4, 1, 5, recent_files, 0, MAX_RECENT );

	add_hseparator( vbox_2, -2, 10 );
	label = gtk_label_new( _("Clipboard Files") );
	gtk_widget_show( label );
	gtk_box_pack_start( GTK_BOX(vbox_2), label, FALSE, FALSE, 0 );

	clipboard_entry = gtk_entry_new();
	gtk_widget_show( clipboard_entry );
	gtk_box_pack_start( GTK_BOX(vbox_2), clipboard_entry, FALSE, FALSE, 0 );
	gtk_entry_set_text( GTK_ENTRY(clipboard_entry), mem_clip_file[0] );
	strncpy( mem_clip_file[1], mem_clip_file[0], 250 );

	button1 = add_a_button( _("Browse"), 4, vbox_2, FALSE );
	gtk_signal_connect(GTK_OBJECT(button1), "clicked",
		GTK_SIGNAL_FUNC(clip_file_browse), NULL);

///	---- TAB3 - STATUS BAR

	hbox4 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox4);
	gtk_container_add (GTK_CONTAINER (notebook1), hbox4);

	vbox_3 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_3);
	gtk_box_pack_start (GTK_BOX (hbox4), vbox_3, FALSE, FALSE, 0);

	label = gtk_label_new( _("Status Bar") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label);

	for ( i=0; i<STATUS_ITEMS; i++ )
	{
		if (i==5)
		{
			vbox_3 = gtk_vbox_new (FALSE, 0);
			gtk_widget_show (vbox_3);
			gtk_box_pack_start (GTK_BOX (hbox4), vbox_3, FALSE, FALSE, 0);
		}
		sprintf(txt, "status%iToggle", i);
		prefs_status[i] = add_a_toggle( stat_tex[i], vbox_3, inifile_get_gboolean(txt, TRUE) );
	}

///	---- TAB4 - ZOOM

	hbox4 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox4);
	gtk_container_add (GTK_CONTAINER (notebook1), hbox4);

	vbox_3 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_3);
	gtk_box_pack_start (GTK_BOX (hbox4), vbox_3, FALSE, FALSE, 0);

	label = gtk_label_new( _("Zoom") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label);
	table5 = add_a_table( 2, 4, 10, vbox_3 );

///	TABLE TEXT
	for ( i=0; i<2; i++ ) add_to_table( tab_tex3[i], table5, i, 0, 0, GTK_JUSTIFY_LEFT, 0, 0.5 );

///	TABLE SPINBUTTONS
	spin_to_table( table5, &spinbutton_grid[0], 0, 1, 5, mem_grid_min, 2, 12 );
	spin_to_table( table5, &spinbutton_grid[1], 1, 1, 5, mem_grid_rgb[0], 0, 255 );
	spin_to_table( table5, &spinbutton_grid[2], 1, 2, 5, mem_grid_rgb[1], 0, 255 );
	spin_to_table( table5, &spinbutton_grid[3], 1, 3, 5, mem_grid_rgb[2], 0, 255 );

	checkbutton_zoom = add_a_toggle( _("New image sets zoom to 100%"),
		vbox_3, inifile_get_gboolean("zoomToggle", FALSE) );
#if GTK_MAJOR_VERSION == 2
	checkbutton_wheel = add_a_toggle( _("Mouse Scroll Wheel = Zoom"),
		vbox_3, inifile_get_gboolean("scrollwheelZOOM", TRUE) );
#endif



///	---- TAB5 - TABLET

	hbox4 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox4);
	gtk_container_add (GTK_CONTAINER (notebook1), hbox4);

	vbox_3 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_3);
	gtk_box_pack_start (GTK_BOX (hbox4), vbox_3, FALSE, FALSE, 0);

	label = gtk_label_new( _("Tablet") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 4), label);



	frame = gtk_frame_new (_("Device Settings"));
	gtk_widget_show (frame);
	gtk_box_pack_start (GTK_BOX (vbox_3), frame, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 5);

	vbox_2 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_2);
	gtk_container_add (GTK_CONTAINER (frame), vbox_2);
	gtk_container_set_border_width (GTK_CONTAINER (vbox_2), 5);

	label_tablet_device = gtk_label_new ("");
	gtk_widget_show (label_tablet_device);
	gtk_box_pack_start (GTK_BOX (vbox_2), label_tablet_device, FALSE, FALSE, 0);
	gtk_misc_set_alignment (GTK_MISC (label_tablet_device), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (label_tablet_device), 5, 5);

	button1 = add_a_button( _("Configure Device"), 0, vbox_2, FALSE );
	gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(conf_tablet), NULL);

	table3 = gtk_table_new (4, 2, FALSE);
	gtk_widget_show (table3);
	gtk_box_pack_start (GTK_BOX (vbox_2), table3, TRUE, TRUE, 0);

	label = add_to_table( _("Tool Variable"), table3, 0, 0, 0, 0, 0, 0 );
	gtk_misc_set_padding (GTK_MISC (label), 5, 5);
	label = add_to_table( _("Factor"), table3, 0, 1, 0, 0, 0, 0 );
	gtk_misc_set_padding (GTK_MISC (label), 5, 5);
	gtk_misc_set_alignment (GTK_MISC (label), 0.4, 0.5);

	for ( i=0; i<3; i++ )
	{
		check_tablet[i] = gtk_check_button_new_with_label (tablet_txt[i]);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_tablet[i]),
			tablet_tool_use[i] );
		gtk_widget_show (check_tablet[i]);
		gtk_table_attach (GTK_TABLE (table3), check_tablet[i], 0, 1, i+1, i+2,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);

//	Size/Flow/Opacity sliders

		hscale_tablet[i] = add_slider2table( 0, -1, 1, table3, 1+i, 1, 200, -2 );
		gtk_adjustment_set_value( GTK_HSCALE(hscale_tablet[i])->scale.range.adjustment,
			tablet_tool_factor[i] );
		gtk_scale_set_value_pos (GTK_SCALE (hscale_tablet[i]), GTK_POS_RIGHT);
		gtk_scale_set_digits (GTK_SCALE (hscale_tablet[i]), 2);
		gtk_scale_set_draw_value (GTK_SCALE (hscale_tablet[i]), TRUE);
	}


	frame = gtk_frame_new (_("Test Area"));
	gtk_widget_show (frame);
	gtk_box_pack_start (GTK_BOX (vbox_3), frame, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (frame), 5);

	vbox_2 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_2);
	gtk_container_add (GTK_CONTAINER (frame), vbox_2);
	gtk_container_set_border_width (GTK_CONTAINER (vbox_2), 5);

	drawingarea_tablet = gtk_drawing_area_new ();
	gtk_widget_show (drawingarea_tablet);
	gtk_box_pack_start (GTK_BOX (vbox_2), drawingarea_tablet, TRUE, TRUE, 0);
	gtk_widget_set_usize (drawingarea_tablet, 128, 64);
	gtk_signal_connect( GTK_OBJECT(drawingarea_tablet), "expose_event",
		GTK_SIGNAL_FUNC (expose_tablet_preview), (gpointer) drawingarea_tablet );

	gtk_signal_connect (GTK_OBJECT (drawingarea_tablet), "motion_notify_event",
		GTK_SIGNAL_FUNC (tablet_preview_motion), NULL);
	gtk_signal_connect (GTK_OBJECT (drawingarea_tablet), "button_press_event",
		GTK_SIGNAL_FUNC (tablet_preview_button), NULL);

	gtk_widget_set_events (drawingarea_tablet, GDK_EXPOSURE_MASK
		| GDK_LEAVE_NOTIFY_MASK
		| GDK_BUTTON_PRESS_MASK
		| GDK_POINTER_MOTION_MASK
		| GDK_POINTER_MOTION_HINT_MASK);

	gtk_widget_set_extension_events (drawingarea_tablet, GDK_EXTENSION_EVENTS_CURSOR);



	label_tablet_pressure = gtk_label_new ("");
	gtk_widget_show (label_tablet_pressure);
	gtk_box_pack_start (GTK_BOX (vbox_2), label_tablet_pressure, FALSE, FALSE, 0);
	gtk_misc_set_alignment (GTK_MISC (label_tablet_pressure), 0, 0.5);



///	---- TAB6 - LANGUAGE

#ifdef U_NLS

	pref_lang_ini[1] = _("Default System Language");
	pref_lang_ini[3] = _("Czech");
	pref_lang_ini[5] = _("English (UK)");
	pref_lang_ini[7] = _("French");
	pref_lang_ini[9] = _("Portuguese");
	pref_lang_ini[11] = _("Portuguese (Brazilian)");
	pref_lang_ini[13] = _("Spanish");

	vbox_2 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_2);
	gtk_container_add (GTK_CONTAINER (notebook1), vbox_2);
	gtk_container_set_border_width( GTK_CONTAINER(vbox_2), 10 );

	label = gtk_label_new( _("Language") );
	gtk_widget_show (label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK (notebook1),
		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 5), label);

	add_hseparator( vbox_2, 200, 10 );
	label = gtk_label_new( _("Select preferred language translation\n\n"
				"You will need to restart mtPaint\nfor this to take full effect") );
	pref_lang_label = label;
	gtk_widget_show (label);
	gtk_box_pack_start( GTK_BOX(vbox_2), label, FALSE, FALSE, 0 );
	add_hseparator( vbox_2, 200, 10 );

	pref_lang_radio[0] = add_radio_button( pref_lang_ini[1], NULL,  NULL, vbox_2, 0 );
	radio_group = gtk_radio_button_group( GTK_RADIO_BUTTON(pref_lang_radio[0]) );
	pref_lang_radio[1] = add_radio_button( pref_lang_ini[3], radio_group, NULL, vbox_2, 1 );
	for ( i=2; i<PREF_LANGS; i++ )
		pref_lang_radio[i] = add_radio_button(
					pref_lang_ini[i*2+1], NULL, pref_lang_radio[1], vbox_2, i );

	for ( i=0; i<PREF_LANGS; i++ )
		gtk_container_set_border_width( GTK_CONTAINER(pref_lang_radio[i]), 5 );

	j = 0;
	for ( i = PREF_LANGS - 1; i>0; i-- )
	{
		if ( strcmp( pref_lang_ini[i*2], inifile_get( "languageSETTING", "system" ) ) == 0 )
			j = i;
	}
	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(pref_lang_radio[j]), TRUE );

#endif



///	Bottom of Prefs window

	hbox4 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox4);
	gtk_box_pack_start (GTK_BOX (vbox3), hbox4, FALSE, FALSE, 0);

	button1 = add_a_button(_("Cancel"), 5, hbox4, TRUE);
	gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(delete_prefs), NULL);
	gtk_widget_add_accelerator (button1, "clicked", ag, GDK_Escape, 0, (GtkAccelFlags) 0);

	button1 = add_a_button(_("Apply"), 5, hbox4, TRUE);
	gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(prefs_apply), NULL);

	button2 = add_a_button(_("OK"), 5, hbox4, TRUE);
	gtk_signal_connect(GTK_OBJECT(button2), "clicked", GTK_SIGNAL_FUNC(prefs_ok), NULL);
	gtk_widget_add_accelerator (button2, "clicked", ag, GDK_Return, 0, (GtkAccelFlags) 0);
	gtk_widget_add_accelerator (button2, "clicked", ag, GDK_KP_Enter, 0, (GtkAccelFlags) 0);


	gtk_signal_connect_object (GTK_OBJECT (prefs_window), "delete_event",
		GTK_SIGNAL_FUNC (delete_prefs), NULL);

	gtk_window_set_transient_for( GTK_WINDOW(prefs_window), GTK_WINDOW(main_window) );
	gtk_widget_show (prefs_window);
	gtk_window_add_accel_group(GTK_WINDOW (prefs_window), ag);

	if ( tablet_working )
	{
		tablet_update_device( tablet_device->name );
	} else	tablet_update_device( "NONE" );
}