Пример #1
0
/**
 * \brief Fill the list with the marks of the model.
 */
void bf::snapshot_frame::fill()
{
  bool enable = false;
  m_snapshot = NULL;

  if ( m_model_frame != NULL )
    if ( m_model_frame->get_model().has_active_action() )
      {
        m_snapshot = m_model_frame->get_model().get_selected_snapshot();

        if ( m_snapshot != NULL )
          {
            enable = true;

            m_date_button->SetLabel
              ( wxString::Format(wxT("%.3f"), m_snapshot->get_date()) );

            m_function_button->SetLabel
              (std_to_wx_string(m_snapshot->get_function()));

            m_function_button->SetLabel
              (std_to_wx_string(m_snapshot->get_function()));

            m_sound_frame->set_sound_description( m_snapshot->get_sound() );

            m_width_spin->SetValue(m_snapshot->get_width());
            m_height_spin->SetValue(m_snapshot->get_height());
            m_x_alignment_choice->SetStringSelection
              (std_to_wx_string(m_snapshot->get_x_alignment()));
            m_y_alignment_choice->SetStringSelection
              (std_to_wx_string(m_snapshot->get_y_alignment()));
            m_x_alignment_value_spin->SetValue
              (m_snapshot->get_x_alignment_value());
            m_y_alignment_value_spin->SetValue
              (m_snapshot->get_y_alignment_value());
          }
      }

  enable_controls(enable);

  fill_mark();
  fill_action();
} // snapshot_frame::fill()
Пример #2
0
//**************************************************************************************
// function name: main
// Description: main function of smash. get command from user and calls command functions
//**************************************************************************************
int main(int argc, char *argv[])
{
    char cmdString[MAX_LINE_SIZE]; 	   
    pJob* job_list_head_ptr;
    struct sigaction ctrl_z_act;
    struct sigaction ctrl_c_act;
    //struct sigaction sigchld_act;

	fill_action(&ctrl_z_act, &ctrl_z_handler);
	fill_action(&ctrl_c_act, &ctrl_c_handler);
	//fill_action(&sigchld_act, &sigchld_handler);

    sigaction(SIGTSTP, &ctrl_z_act,NULL);
    sigaction(SIGINT, &ctrl_c_act,NULL);
    //sigaction(SIGCHLD,&sigchld_act,NULL);
    int dead_pid;

	//signal declaretions
	//NOTE: the signal handlers and the function/s that sets the handler should be found in siganls.c
	 /* add your code here */
	
	/************************************/
	//NOTE: the signal handlers and the function/s that sets the handler should be found in siganls.c
	//set your signal handlers here
	/* add your code here */

	/************************************/

	/************************************/
    // Init globals
	GPid = -1;
	Last_Bg_Pid = -1;
	Susp_Bg_Pid = -1;
	susp = 0;
	job_list_head = NULL;
	job_list_head_ptr = &job_list_head;


#if 0
	L_Fg_Cmd =(char*)malloc(sizeof(char)*(MAX_LINE_SIZE+1));
	if (L_Fg_Cmd == NULL) 
			exit (-1); 
	L_Fg_Cmd[0] = '\0';
#endif
    	while (1)
    	{
    	printf("smash > ");

    		while((dead_pid=waitpid(-1,NULL,WNOHANG))>0)// This loop is in charge of handling zombies
    		{
    			remove_job(&job_list_head,dead_pid);
    		}
    		if((dead_pid==-1) && (errno=EINTR))
    		{
    			//refresh_list(job_list_head_ptr);
    		}

		fgets(lineSize, MAX_LINE_SIZE, stdin);
		strcpy(cmdString, lineSize);    	
		cmdString[strlen(lineSize)-1]='\0';
					// perform a complicated Command
		if(!ExeComp(lineSize)) continue; 
					// background command	
	 	if(!BgCmd(lineSize, job_list_head_ptr)) continue;
					// built in commands
		ExeCmd(&job_list_head, lineSize, cmdString);
		/* initialize for next line read*/
		lineSize[0]='\0';
		cmdString[0]='\0';
		fflush(stdout);
		fflush(stdin);
	}
    return 0;
}