Exemplo n.º 1
0
/**
 * 	\fn ADM_getRelativePath
 */
char *ADM_getRelativePath(const char *base0, const char *base1, const char *base2, const char *base3)
{
	char *result;
	int length = strlen(base0) + 2;

	if (base1)
		length += strlen(base1) + 1;

	if (base2)
		length += strlen(base2) + 1;

	if (base3)
		length += strlen(base3) + 1;

	result = (char *)new char[length];
	strcpy(result, base0);
	AddSeparator(result);

	if (base1)
	{
		if (strlen(base1))
		{
			strcat(result, base1);
			strcat(result, ADM_SEPARATOR);
		}

		if (base2)
		{
			if (strlen(base2))
			{
				strcat(result, base2);
				strcat(result, ADM_SEPARATOR);
			}

			if (base3 && strlen(base3))
			{
				strcat(result, base3);				
				strcat(result, ADM_SEPARATOR);
			}
		}
	}

	return result;
}
Exemplo n.º 2
0
int CBCGPMSMTasksPane::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPTasksPane::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	int nGroup = AddGroup (_T(""));

	COleDateTime now = COleDateTime::GetCurrentTime ();
	CString strDate = now.Format (_T("%B %d, %Y"));

	AddLabel (nGroup, strDate, -1, TRUE);

	AddLabel (nGroup, _T(" "));
	AddLabel (nGroup, _T(" "));
	
	AddLabel (nGroup, _T("Common tasks"), -1, TRUE);
	AddSeparator (nGroup);

	AddTask (nGroup, _T("Learn more about BCGControlBar library"), -1, ID_HELP_BCGSOFT);

	return 0;
}
Exemplo n.º 3
0
void CGUIDialogLockSettings::CreateSettings()
{
  // clear out any old settings
  m_settings.clear();
  // create our settings
  if (m_bGetUser)
  {
    AddButton(1,20142);
    if (!m_strUser.IsEmpty())
      m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
    AddButton(2,12326);
    if (!m_locks.code.IsEmpty())
      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
    if (m_saveUserDetails)
      AddBool(3, 13423, m_saveUserDetails);
    return;
  }
  AddButton(1,m_iButtonLabel);
  if (m_locks.mode > LOCK_MODE_QWERTY)
    m_locks.mode = LOCK_MODE_EVERYONE;
  if (m_locks.mode != LOCK_MODE_EVERYONE)
    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
  else
    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());

  if (m_bDetails)
  {
    AddSeparator(2);
    AddBool(3,20038,&m_locks.music);
    AddBool(4,20039,&m_locks.video);
    AddBool(5,20040,&m_locks.pictures);
    AddBool(6,20041,&m_locks.programs);
    AddBool(7,20042,&m_locks.files);
    AddBool(8,20043,&m_locks.settings);
    AddBool(9,24090,&m_locks.addonManager);
    EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
  }
}
Exemplo n.º 4
0
		// Добавляет сепаратор, кнопки OK и Cancel.
		void AddOKCancel(int OKMessageId, int CancelMessageId, int ExtraMessageId = -1, bool Separator=true)
		{
			if (Separator)
				AddSeparator();

			T *OKButton = AddDialogItem(DI_BUTTON, GetLangString(OKMessageId));
			OKButton->Flags = DIF_CENTERGROUP|DIF_DEFAULTBUTTON;
			OKButton->Y1 = OKButton->Y2 = NextY++;
			OKButtonID = DialogItemsCount-1;

			if(CancelMessageId != -1)
			{
				T *CancelButton = AddDialogItem(DI_BUTTON, GetLangString(CancelMessageId));
				CancelButton->Flags = DIF_CENTERGROUP;
				CancelButton->Y1 = CancelButton->Y2 = OKButton->Y1;
			}

			if(ExtraMessageId != -1)
			{
				T *ExtraButton = AddDialogItem(DI_BUTTON, GetLangString(ExtraMessageId));
				ExtraButton->Flags = DIF_CENTERGROUP;
				ExtraButton->Y1 = ExtraButton->Y2 = OKButton->Y1;
			}
		}
void MainToolBar::set_properties()
{
#ifdef __WXMAC__
	SetToolBitmapSize(wxSize(96, 24));
    AddTool(IDM_MENU, wxT("Menu"), wxBitmap(menu_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
	AddSeparator();
    AddTool(IDM_SHOW_DESK, wxT("Desk"), wxBitmap(desk_xpm), wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddTool(IDM_SHOW_DESK_SETUP, wxT("Desk Setup"), wxBitmap(desk_setup_xpm), wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddTool(IDM_SHOW_FUNCTION_SETUP, wxT("Function Setup"), wxBitmap(function_setup_xpm), wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddSeparator();
    AddTool(IDM_IO_SETUP, wxT("IO Setup"), wxBitmap(io_setup_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_GROUP_SETUP, wxT("Group Setup"), wxBitmap(group_setup_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_CHANNEL_SETUP, wxT("Channel Setup"), wxBitmap(channel_setup_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_LIBRARY, wxT("Library"), wxBitmap(library_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_DMX_PATCH, wxT("DMX Patch"), wxBitmap(dmx_patch_xpm), wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddSeparator();
    AddTool(IDM_SETUP_OUTPUT, wxT("Setup Output"), wxBitmap(setup_output_xpm), wxNullBitmap, wxITEM_CHECK, wxT(""), wxT(""));
#else
 	SetToolBitmapSize(wxSize(0, 0));
    AddTool(IDM_MENU, wxT("Menu"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
	AddSeparator();
    AddTool(IDM_SHOW_DESK, wxT("Desk"), wxNullBitmap, wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddTool(IDM_SHOW_DESK_SETUP, wxT("Desk Setup"), wxNullBitmap, wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddTool(IDM_SHOW_FUNCTION_SETUP, wxT("Function Setup"), wxNullBitmap, wxNullBitmap, wxITEM_RADIO, wxT(""), wxT(""));
    AddSeparator();
    AddTool(IDM_IO_SETUP, wxT("IO Setup"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_GROUP_SETUP, wxT("Group Setup"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_CHANNEL_SETUP, wxT("Channel Setup"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_LIBRARY, wxT("Library"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddTool(IDM_DMX_PATCH, wxT("DMX Patch"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
    AddSeparator();
    AddTool(IDM_SETUP_OUTPUT, wxT("Setup Output"), wxNullBitmap, wxNullBitmap, wxITEM_CHECK, wxT(""), wxT(""));
#endif
	
    Realize();
}
Exemplo n.º 6
0
GtkWidget * create_PopUpMenu( void )
{
 GtkWidget * window1;
 GtkWidget * Menu = NULL;
 GtkWidget * SubMenu = NULL;
 GtkWidget * MenuItem = NULL;
 GtkWidget * H, * N, * D, * F;
 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
 int global_sub_size = mpctx_get_global_sub_size(guiIntfStruct.mpcontext);

 Menu=gtk_menu_new();
 gtk_widget_realize (Menu);
 window1 = gtk_widget_get_toplevel(Menu);


  AddMenuItem( window1, (const char*)ab_xpm, Menu,MSGTR_MENU_AboutMPlayer"     ", evAbout );
  AddSeparator( Menu );
   SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open );
    AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile"    ", evLoadPlay );
#ifdef HAVE_VCD
    AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
#endif
#ifdef USE_DVDREAD
    AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
#endif
    AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL );
    AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle"   ", evLoadSubtitle );
    AddMenuItem( window1, (const char*)delsub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
    AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
   SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing );
    AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play"        ", evPlay );
    AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause );
    AddMenuItem( window1, (const char*)stop2_xpm, SubMenu,MSGTR_MENU_Stop, evStop );
    AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext );
    AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev );
//    AddSeparator( SubMenu );
//    AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
//    AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
//    AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
//    AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
//   SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
//    AddMenuItem( SubMenu,MSGTR_MENU_NormalSize"      ", evNormalSize );
//    AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
//    AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
#ifdef HAVE_VCD
   VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD );
    AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
    AddSeparator( VCDSubMenu );
    VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
    if ( guiIntfStruct.VCDTracks ) 
     {
      char tmp[32]; int i;
      for ( i=0;i < guiIntfStruct.VCDTracks;i++ )
       {
        snprintf( tmp,32,MSGTR_MENU_Title,i+1 );
    //AddMenuItem( VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack );
        AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack );
       }
     }
     else
      {
       MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone );
       gtk_widget_set_sensitive( MenuItem,FALSE );
      }
#endif
#ifdef USE_DVDREAD
   DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD );
    AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc"    ", evPlayDVD );
//    AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
    AddSeparator( DVDSubMenu );
    DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
     if ( guiIntfStruct.DVD.titles )
      {
       char tmp[32]; int i;
       for ( i=1 ; i<= guiIntfStruct.DVD.titles;i++ )
        {
         snprintf( tmp,32,MSGTR_MENU_Title,i);
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
			   guiIntfStruct.DVD.current_title == i,
			   (i << 16) + evSetDVDTitle );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
     if ( guiIntfStruct.DVD.chapters )
      {
       char tmp[32]; int i;
       for ( i=1;i <= guiIntfStruct.DVD.chapters;i++ )
        {
         snprintf( tmp,32,MSGTR_MENU_Chapter,i );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiIntfStruct.DVD.current_chapter == i,
			   ( i << 16 ) + evSetDVDChapter );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)tongue_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages );
     if ( guiIntfStruct.DVD.nr_of_audio_channels )
      {
       char tmp[64]; int i, id = guiIntfStruct.demuxer ? ((demuxer_t *)guiIntfStruct.demuxer)->audio->id : audio_id;
       for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ )
        {
	 snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ),
	   ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ],
	   ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] );
//	 if ( id == -1 ) id=audio_id; //guiIntfStruct.DVD.audio_streams[i].id;
         AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp,
			   id == guiIntfStruct.DVD.audio_streams[i].id,
			   ( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)tonguebla_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages );
     if ( guiIntfStruct.DVD.nr_of_subtitles )
      {
       char tmp[64]; int i;
       AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle );
       for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ )
        {
	 snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp,
			   dvdsub_id == guiIntfStruct.DVD.subtitles[i].id,
			   ( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
#endif

//  if ( guiIntfStruct.Playing )
   {
    AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio );
    AddMenuItem( window1, (const char*)a11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect );
    AddMenuItem( window1, (const char*)a169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect );
    AddMenuItem( window1, (const char*)a43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect );
    AddMenuItem( window1, (const char*)a235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
   }

  if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
   {
    int i,c = 0;

    for ( i=0;i < MAX_A_STREAMS;i++ )
     if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) c++;
    
    if ( c > 1 )
     {
      SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack );
      for ( i=0;i < MAX_A_STREAMS;i++ )
       if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] )
        {
         int aid = ((sh_audio_t *)((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i])->aid;
         char tmp[32];
         snprintf( tmp,32,MSGTR_MENU_Track,aid );
         AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio );
        }
     }

    for ( c=0,i=0;i < MAX_V_STREAMS;i++ )
     if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) c++;
    
    if ( c > 1 )
     {
      SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack );
      for ( i=0;i < MAX_V_STREAMS;i++ )
       if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] )
        {
         int vid = ((sh_video_t *)((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i])->vid;
         char tmp[32];
         snprintf( tmp,32,MSGTR_MENU_Track,vid );
         AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo );
        }
     }
   }
  
  /* cheap subtitle switching for non-DVD streams */
  if ( global_sub_size && guiIntfStruct.StreamType != STREAMTYPE_DVD )
   {
    int i;
    SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles );
    AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle );
    for ( i=0;i < global_sub_size;i++ )
     {
      char tmp[32];
      snprintf( tmp, 32, MSGTR_MENU_Track, i );
      AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle );
     }
   }

  AddSeparator( Menu );
  MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute );
  if ( !guiIntfStruct.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE );
  AddMenuItem( window1, (const char*)pl_xpm, Menu,MSGTR_MENU_PlayList, evPlayList );
  AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
  AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences );
  AddMenuItem( window1, (const char*)eq_xpm, Menu,MSGTR_Equalizer, evEqualizer );

  if ( guiIntfStruct.NoWindow == False )
   {
    int b1 = 0, b2 = 0, b_half = 0;
    AddSeparator( Menu );
    if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing )
     {
      if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&& 
           ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight * 2 ) ) b2=1;
      else if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth / 2 ) && 
                ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight / 2 ) ) b_half=1;
      else b1=1;
     } else b1=!appMPlayer.subWindow.isFullScreen;
    H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize );
    N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize"      ",b1,evNormalSize );
    D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
    F=AddMenuCheckItem( window1, (const char*)fs_xpm, Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen );
  if ( !gtkShowVideoWindow && !guiIntfStruct.Playing )
   {
    gtk_widget_set_sensitive( H,FALSE );
    gtk_widget_set_sensitive( N,FALSE );
    gtk_widget_set_sensitive( D,FALSE );
    gtk_widget_set_sensitive( F,FALSE );
   }
   }

  AddSeparator( Menu );
  AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit );

 return Menu;
}
Exemplo n.º 7
0
std::set<std::string> CGUIDialogSettingsBase::CreateSettings()
{
  FreeSettingsControls();

  std::set<std::string> settingMap;

  if (m_categories.size() <= 0)
    return settingMap;

  if (m_iCategory < 0 || m_iCategory >= (int)m_categories.size())
    m_iCategory = 0;

  CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(SETTINGS_GROUP_ID));
  if (group == NULL)
    return settingMap;

  const CSettingCategory* category = m_categories.at(m_iCategory);
  if (category == NULL)
    return settingMap;

  // set the description of the current category
  SetDescription(category->GetHelp());

  const SettingGroupList& groups = category->GetGroups((SettingLevel)GetSettingLevel());
  int iControlID = CONTROL_SETTINGS_START_CONTROL;
  bool first = true;
  for (SettingGroupList::const_iterator groupIt = groups.begin(); groupIt != groups.end(); ++groupIt)
  {
    if (*groupIt == NULL)
      continue;

    const SettingList& settings = (*groupIt)->GetSettings((SettingLevel)GetSettingLevel());
    if (settings.size() <= 0)
      continue;

    const CSettingControlTitle *title = dynamic_cast<CSettingControlTitle *>((*groupIt)->GetControl());
    bool hideSeparator = title ? title->IsSeparatorHidden() : false;
    bool separatorBelowGroupLabel = title ? title->IsSeparatorBelowLabel() : false;
    int groupLabel = (*groupIt)->GetLabel();

    // hide the separator for the first settings grouplist if it
    // is the very first item in the list (also above the label)
    if (first)
    {
      first = false;
      if (groupLabel <= 0)
        hideSeparator = true;
    }
    else if (!separatorBelowGroupLabel && !hideSeparator)
      AddSeparator(group->GetWidth(), iControlID);

    if (groupLabel > 0)
      AddLabel(group->GetWidth(), iControlID, groupLabel);

    if (separatorBelowGroupLabel && !hideSeparator)
      AddSeparator(group->GetWidth(), iControlID);

    for (SettingList::const_iterator settingIt = settings.begin(); settingIt != settings.end(); ++settingIt)
    {
      CSetting *pSetting = *settingIt;
      settingMap.insert(pSetting->GetId());
      AddSetting(pSetting, group->GetWidth(), iControlID);
    }
  }

  if (AllowResettingSettings() && !settingMap.empty())
  {
    // add "Reset" control
    AddSeparator(group->GetWidth(), iControlID);
    AddSetting(m_resetSetting, group->GetWidth(), iControlID);
  }
  
  // update our settings (turns controls on/off as appropriate)
  UpdateSettings();

  return settingMap;
}
Exemplo n.º 8
0
		// Добавляет сепаратор.
		void AddSeparator(int MessageId=-1)
		{
			return AddSeparator(MessageId == -1 ? L"" : GetLangString(MessageId));
		}
Exemplo n.º 9
0
void EditToolBar::Populate()
{
   MakeButtonBackgroundsSmall();

   /* Buttons */
   AddButton(bmpCut, bmpCut, bmpCutDisabled, ETBCutID,
      _("Cut selection"));
   AddButton(bmpCopy, bmpCopy, bmpCopyDisabled, ETBCopyID,
      _("Copy selection"));
   AddButton(bmpPaste, bmpPaste, bmpPasteDisabled, ETBPasteID,
      _("Paste"));
   AddButton(bmpTrim, bmpTrim, bmpTrimDisabled, ETBTrimID,
      _("Trim audio outside selection"));
   AddButton(bmpSilence, bmpSilence, bmpSilenceDisabled, ETBSilenceID,
      _("Silence audio selection"));

   AddSeparator();

   AddButton(bmpUndo, bmpUndo, bmpUndoDisabled, ETBUndoID,
      _("Undo"));
   AddButton(bmpRedo, bmpRedo, bmpRedoDisabled, ETBRedoID,
      _("Redo"));

   AddSeparator();

#ifdef EXPERIMENTAL_SYNC_LOCK
   AddButton(bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksDisabled, ETBSyncLockID,
               _("Sync-Lock Tracks"), true);

   AddSeparator();
#endif

   AddButton(bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID,
      _("Zoom In"));
   AddButton(bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID,
      _("Zoom Out"));

   AddButton(bmpZoomSel, bmpZoomSel, bmpZoomSelDisabled, ETBZoomSelID,
      _("Fit selection in window"));
   AddButton(bmpZoomFit, bmpZoomFit, bmpZoomFitDisabled, ETBZoomFitID,
      _("Fit project in window"));

   mButtons[ETBZoomInID]->SetEnabled(false);
   mButtons[ETBZoomOutID]->SetEnabled(false);

   mButtons[ETBZoomSelID]->SetEnabled(false);
   mButtons[ETBZoomFitID]->SetEnabled(false);
   mButtons[ETBPasteID]->SetEnabled(false);

#ifdef EXPERIMENTAL_SYNC_LOCK
   mButtons[ETBSyncLockID]->PushDown();
#endif

#if defined(EXPERIMENTAL_EFFECTS_RACK)
   AddSeparator();
   AddButton(bmpEditEffects, bmpEditEffects, bmpEditEffects, ETBEffectsID,
      _("Show Effects Rack"), true);
#endif

   RegenerateTooltips();
}
Exemplo n.º 10
0
GtkWidget * CreatePopUpMenu( void )
{
 GtkWidget * window1;
 GtkWidget * Menu = NULL;
 GtkWidget * SubMenu = NULL;
 GtkWidget * MenuItem = NULL;
 GtkWidget * H, * N, * D, * F;
 demuxer_t *demuxer = mpctx_get_demuxer(guiInfo.mpcontext);
 mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
 int subs = 0, sub_pos;

 Menu=gtk_menu_new();
 gtk_widget_realize (Menu);
 window1 = gtk_widget_get_toplevel(Menu);


  AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_GUI_AboutMPlayer"     ", evAbout );
  AddSeparator( Menu );
   SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_GUI_Open );
    AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_GUI_File"...    ", evLoadPlay );
#ifdef CONFIG_CDDA
    AddMenuItem( window1, (const char*)playcd_xpm, SubMenu,MSGTR_GUI_CD, evPlayCD );
    CDSubMenu=AddSubMenu( window1, (const char*)cd_xpm, Menu,MSGTR_GUI_CD );
    AddMenuItem( window1, (const char*)playcd_xpm, CDSubMenu,MSGTR_GUI_Play,evPlayCD );
    AddSeparator( CDSubMenu );
    CDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, CDSubMenu,MSGTR_GUI_Titles );
    if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_CDDA ) )
     {
      char tmp[32]; int i;
      for ( i=1;i <= guiInfo.Tracks;i++ )
       {
        snprintf( tmp,32,MSGTR_GUI_TitleNN,i );
    //AddMenuItem( CDTitleMenu,tmp,( i << 16 ) + ivSetCDTrack );
        AddMenuCheckItem(window1, (const char*)empty1px_xpm, CDTitleMenu,tmp, guiInfo.Track == i, ( i << 16 ) + ivSetCDTrack );
       }
     }
     else
      {
       MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, CDTitleMenu,MSGTR_GUI__none_,evNone );
       gtk_widget_set_sensitive( MenuItem,FALSE );
      }
#endif
#ifdef CONFIG_VCD
    AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_GUI_VCD, evPlayVCD );
    VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_GUI_VCD );
    AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_GUI_Play,evPlayVCD );
    AddSeparator( VCDSubMenu );
    VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_GUI_Titles );
    if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_VCD ) )
     {
      char tmp[32]; int i;
      for ( i=1;i < guiInfo.Tracks;i++ )
       {
        snprintf( tmp,32,MSGTR_GUI_TitleNN,i );
    //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + ivSetVCDTrack );
        AddMenuCheckItem(window1, (const char*)empty1px_xpm, VCDTitleMenu,tmp, guiInfo.Track == i + 1, ( ( i + 1 ) << 16 ) + ivSetVCDTrack );
       }
     }
     else
      {
       MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, VCDTitleMenu,MSGTR_GUI__none_,evNone );
       gtk_widget_set_sensitive( MenuItem,FALSE );
      }
#endif
#ifdef CONFIG_DVDREAD
    AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_GUI_DVD, evPlayDVD );
    DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_GUI_DVD );
    AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_GUI_Play"    ", evPlayDVD );
//    AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
    AddSeparator( DVDSubMenu );
    DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_GUI_Titles );
     if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
      {
       char tmp[32]; int i;
       for ( i=1 ; i<= guiInfo.Tracks;i++ )
        {
         snprintf( tmp,32,MSGTR_GUI_TitleNN,i);
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
         guiInfo.Track == i,
         (i << 16) + ivSetDVDTitle );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,MSGTR_GUI__none_,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_GUI_Chapters );
     if ( guiInfo.Chapters && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
      {
       char tmp[32]; int i;
       for ( i=1;i <= guiInfo.Chapters;i++ )
        {
         snprintf( tmp,32,MSGTR_GUI_ChapterNN,i );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.Chapter == i,
         ( i << 16 ) + ivSetDVDChapter );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,MSGTR_GUI__none_,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)audio_xpm, DVDSubMenu,MSGTR_GUI_AudioTracks );
     if ( guiInfo.AudioStreams && demuxer && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
      {
       char tmp[64]; int i;
       for ( i=0;i < guiInfo.AudioStreams;i++ )
        {
   snprintf( tmp,64,"%s - %s %s",GetLanguage( &guiInfo.AudioStream[i].language, GET_LANG_INT ),
     ChannelTypes[ guiInfo.AudioStream[i].type ],
     ChannelNumbers[ guiInfo.AudioStream[i].channels ] );
         AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp,
         demuxer->audio->id == guiInfo.AudioStream[i].id,
         ( guiInfo.AudioStream[i].id << 16 ) + ivSetDVDAudio );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDAudioLanguageMenu,MSGTR_GUI__none_,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
    DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)subtitle_xpm, DVDSubMenu,MSGTR_GUI_Subtitles );
     if ( guiInfo.Subtitles && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
      {
       char tmp[64]; int i;
       AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_GUI__none_,( (unsigned short)-1 << 16 ) + ivSetDVDSubtitle );
       for ( i=0;i < guiInfo.Subtitles;i++ )
        {
         av_strlcpy( tmp,GetLanguage( &guiInfo.Subtitle[i].language, GET_LANG_INT ),sizeof(tmp) );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp,
         dvdsub_id == guiInfo.Subtitle[i].id,
         ( guiInfo.Subtitle[i].id << 16 ) + ivSetDVDSubtitle );
        }
      }
      else
       {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_GUI__none_,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
       }
#endif
#if defined(CONFIG_LIBCDIO) || defined(CONFIG_DVDREAD)
    AddMenuItem( window1, (const char*)playimage_xpm, SubMenu,MSGTR_GUI_Image"...    ", evPlayImage );
#endif
    AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_GUI_URL"...", evLoadURL );
#ifdef CONFIG_TV
    AddMenuItem( window1, (const char*)tv_xpm, SubMenu,MSGTR_GUI_TV, evPlayTV );
#endif
    AddSeparator( SubMenu );
    AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_GUI_AudioTrack"...", evLoadAudioFile );
    AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_GUI_Subtitle"...   ", evLoadSubtitle );
    AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_GUI_DropSubtitle,evDropSubtitle );
   SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_GUI_Playback );
    AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_GUI_Play"        ", evPlay );
    AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_GUI_Pause, evPause );
    AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_GUI_Stop, evStop );
    AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_GUI_Next, evNext );
    AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_GUI_Previous, evPrev );
//    AddSeparator( SubMenu );
//    AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
//    AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
//    AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
//    AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
//   SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
//    AddMenuItem( SubMenu,MSGTR_GUI_SizeNormal"      ", evNormalSize );
//    AddMenuItem( SubMenu,MSGTR_GUI_SizeDouble, evDoubleSize );
//    AddMenuItem( SubMenu,MSGTR_GUI_SizeFullscreen, evFullScreen + ( True << 16 ) );

  if ( guiInfo.VideoWindow )
   {
    AddSeparator( Menu );
    RotationMenu=AddSubMenu( window1, (const char*)rotate_xpm, Menu,MSGTR_GUI_Rotation );
    N=AddMenuCheckItem( window1, (const char*)rotate0_xpm, RotationMenu,MSGTR_GUI__none_, guiInfo.Rotation == -1, evSetRotation );
    D=AddMenuCheckItem( window1, (const char*)rotate90cw_xpm, RotationMenu,MSGTR_GUI_Rotation90CW, guiInfo.Rotation == 1, evSetRotation + ( 90 << 16 ) );
    F=AddMenuCheckItem( window1, (const char*)rotate90ccw_xpm, RotationMenu,MSGTR_GUI_Rotation90CCW, guiInfo.Rotation == 2, evSetRotation + ( -90 << 16 ) );
    H=AddMenuCheckItem( window1, (const char*)rotate180_xpm, RotationMenu,MSGTR_GUI_Rotation180, guiInfo.Rotation == 8, evSetRotation + ( 180 << 16 ) );

    if ( !guiInfo.Playing )
     {
      gtk_widget_set_sensitive( N,FALSE );
      gtk_widget_set_sensitive( D,FALSE );
      gtk_widget_set_sensitive( F,FALSE );
      gtk_widget_set_sensitive( H,FALSE );
     }
   }

  if ( guiInfo.VideoWindow )
   {
    int a11 = False, a169 = False, a43 = False, a235 = False;

    if (movie_aspect == -1.0f) a11 = True;
    else
     {
       a169 = (FFABS(movie_aspect - 16.0f / 9.0f) <= 0.01f);
       a43 = (FFABS(movie_aspect - 4.0f / 3.0f) <= 0.01f);
       a235 = (FFABS(movie_aspect - 2.35f) <= 0.01f);
     }

    AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_GUI_AspectRatio );
    H=AddMenuCheckItem( window1, (const char*)aspect11_xpm, AspectMenu,MSGTR_GUI_Original, a11, evSetAspect + ( 1 << 16 ) );
    N=AddMenuCheckItem( window1, (const char*)aspect169_xpm, AspectMenu,"16:9", a169, evSetAspect + ( 2 << 16 ) );
    D=AddMenuCheckItem( window1, (const char*)aspect43_xpm, AspectMenu,"4:3", a43, evSetAspect + ( 3 << 16 ) );
    F=AddMenuCheckItem( window1, (const char*)aspect235_xpm, AspectMenu,MSGTR_GUI_235To1, a235, evSetAspect + ( 4 << 16 ) );

    if ( !guiInfo.Playing )
     {
      gtk_widget_set_sensitive( H,FALSE );
      gtk_widget_set_sensitive( N,FALSE );
      gtk_widget_set_sensitive( D,FALSE );
      gtk_widget_set_sensitive( F,FALSE );
     }
   }

  if ( guiInfo.VideoWindow )
   {
    int b1 = False, b2 = False, b_half = False;

    if ( !guiApp.videoWindow.isFullScreen && guiInfo.Playing )
     {
      if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth * 2 )&&
           ( guiApp.videoWindow.Height == guiInfo.VideoHeight * 2 ) ) b2=True;
      else if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth / 2 ) &&
                ( guiApp.videoWindow.Height == guiInfo.VideoHeight / 2 ) ) b_half=True;
      else b1=( guiApp.videoWindow.Width == guiInfo.VideoWidth && guiApp.videoWindow.Height == guiInfo.VideoHeight );
     } else b1=!guiApp.videoWindow.isFullScreen;
    F=AddMenuCheckItem( window1, (const char*)full_xpm, Menu,MSGTR_GUI_SizeFullscreen,guiApp.videoWindow.isFullScreen,evFullScreen + ( True << 16 ) );
    D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_GUI_SizeDouble,b2,evDoubleSize );
    N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_GUI_SizeNormal"      ",b1,evNormalSize );
    H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_GUI_SizeHalf,b_half,evHalfSize );
    if ( !guiInfo.Playing )
     {
      gtk_widget_set_sensitive( H,FALSE );
      gtk_widget_set_sensitive( N,FALSE );
      gtk_widget_set_sensitive( D,FALSE );
      gtk_widget_set_sensitive( F,FALSE );
     }
   }

  AddSeparator( Menu );
  MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_GUI_Mute,mixer->muted,evMute );
  if ( !guiInfo.AudioChannels ) gtk_widget_set_sensitive( MenuItem,FALSE );

  if ( guiInfo.Playing && demuxer && guiInfo.StreamType != STREAMTYPE_DVD )
   {
    int i,c = 0;

    for ( i=0;i < MAX_A_STREAMS;i++ )
     if ( demuxer->a_streams[i] ) c++;

    if ( c > 1 )
     {
      SubMenu=AddSubMenu( window1, (const char*)audio_xpm, Menu,MSGTR_GUI_AudioTracks );
      for ( i=0;i < MAX_A_STREAMS;i++ )
       if ( demuxer->a_streams[i] )
        {
         int aid = ((sh_audio_t *)demuxer->a_streams[i])->aid;
         int selected_id = (audio_id == aid || (audio_id == -1 && aid == demuxer_default_audio_track(demuxer)));
         char lng[32], tmp[64];
         if ( demuxer_audio_lang( demuxer, i, lng, sizeof(lng) ) == 0 ) snprintf( tmp,sizeof(tmp),MSGTR_GUI_TrackN" - %s",aid,GetLanguage( lng, GET_LANG_CHR ) );
         else snprintf( tmp,sizeof(tmp),MSGTR_GUI_TrackN,aid );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu,tmp,selected_id,( aid << 16 ) + ivSetAudio );
        }
     }

    for ( c=0,i=0;i < MAX_V_STREAMS;i++ )
     if ( demuxer->v_streams[i] ) c++;

    if ( c > 1 )
     {
      SubMenu=AddSubMenu( window1, (const char*)video_xpm, Menu,MSGTR_GUI_VideoTracks );
      for ( i=0;i < MAX_V_STREAMS;i++ )
       if ( demuxer->v_streams[i] )
        {
         int vid = ((sh_video_t *)demuxer->v_streams[i])->vid;
         char tmp[32];
         int selected_id = (video_id == vid || (video_id == -1 && vid == demuxer_default_video_track(demuxer)));
         snprintf( tmp,32,MSGTR_GUI_TrackN,vid );
         AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu,tmp,selected_id,( vid << 16 ) + ivSetVideo );
        }
     }
   }

  /* cheap subtitle switching for non-DVD streams */

  mpctx_get_global_sub_info(guiInfo.mpcontext, &subs, &sub_pos);

  if ( subs && guiInfo.StreamType != STREAMTYPE_DVD )
   {
    int i, j, subs0 = guiInfo.mpcontext->sub_counts[SUB_SOURCE_SUBS], subs1 = guiInfo.mpcontext->sub_counts[SUB_SOURCE_VOBSUB];
    SubMenu=AddSubMenu( window1, (const char*)subtitle_xpm, Menu, MSGTR_GUI_Subtitles );
    AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu, MSGTR_GUI__none_, sub_pos == -1, (-1 << 16) + ivSetSubtitle );
    for ( i=0;i < subs;i++ )
     {
      int ret = -1;
      char lng[32], tmp[64], *lang = NULL;
      /* file */
      if ( i < subs0 )
       {
        if ( guiInfo.mpcontext->set_of_subtitles[i] ) lang = guiInfo.mpcontext->set_of_subtitles[i]->filename;
#ifdef CONFIG_ASS
        if ( ass_track && ass_track->name ) lang = ass_track->name;
#endif
        if ( lang )
         {
          av_strlcpy( lng, mp_basename(lang), sizeof(lng) );
          ret = 0;
         }
       }
      /* VOBsub */
      else if ( ( i >= subs0 && i < subs0 + subs1 ) && vo_vobsub )
       {
        lang = vobsub_get_id( vo_vobsub, vobsub_get_id_by_index( vo_vobsub, i - subs0 ) );

        if ( lang )
         {
          av_strlcpy( lng, lang, sizeof(lng) );
          ret = 0;
         }
       }
      /* embedded (demuxer) */
      else if ( ( i >= subs0 + subs1 ) && demuxer )
       {
        for ( j=0;j < MAX_S_STREAMS;j++ )
         {
          if ( demuxer->s_streams[j] ) ret++;
          if ( ret == i - subs0 - subs1 )
          {
           ret = demuxer_sub_lang( demuxer, j, lng, sizeof(lng) );
           break;
          }
         }
       }
      if ( ret == 0 ) snprintf( tmp, sizeof(tmp), MSGTR_GUI_TrackN" - %s", i, GetLanguage( lng, GET_LANG_CHR ) );
      else snprintf( tmp, sizeof(tmp), MSGTR_GUI_TrackN, i );
      AddMenuCheckItem( window1,(const char*)empty1px_xpm,SubMenu,tmp,sub_pos == i,( i << 16 ) + ivSetSubtitle );
     }
   }

  AddSeparator( Menu );
  AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_GUI_Equalizer, evEqualizer );
  AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_GUI_Playlist, evPlaylist );
  AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_GUI_SkinBrowser, evSkinBrowser );
  AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_GUI_Preferences, evPreferences );

  AddSeparator( Menu );
  AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_GUI_Quit, evExit );

 return Menu;
}
Exemplo n.º 11
0
BOOL CAddItem::Insert(LPCTSTR tstrXmlFileInp, LPCTSTR tstrXmlFileOut)
{
   BOOL bResult = FALSE;

   try
   {
      //init
      hr = docPtr.CreateInstance(_T("msxml2.domdocument"));
      if(!SUCCEEDED(hr))
      {
         return bResult;
      }
      docPtr->async = FALSE;
      docPtr->preserveWhiteSpace = FALSE;
      // load a document
      _variant_t varXml(tstrXmlFileInp);
      _variant_t varOut((bool)TRUE);
      if(docPtr->load(varXml) == FALSE)
      {
         ErrorMessage();
         return bResult;
      }

      root = docPtr->documentElement->selectSingleNode(_T("channel"));
      if(root == NULL)
      {
         return bResult;
      }
      AddSeparator(root, _T("\n  "));

      // build tree
      MSXML2::IXMLDOMNodePtr item = docPtr->createElement(_T("item"));
      if(item == NULL)
      {
         return FALSE;
      }      
      
      AddSeparator(item);
      // build title
      bResult = AddElement(item, _T("title"), csTitle);    
      AddSeparator(item);
      // build author
      bResult &= AddElement(item, _T("itunes:author"), csAuthor);
      AddSeparator(item);
      // build description
      bResult &= AddElement(item, _T("description"), _T(""));
      AddSeparator(item);
      // build enclosure
      bResult &= AddElementAndAttributes(item, _T("enclosure"), _T(""));
      AddSeparator(item);
      // build pubdate
      bResult &= AddElement(item, _T("pubDate"), csDate);
      AddSeparator(item, _T("\n  "));
      
      if(bResult)
      {
         hr = root->appendChild(item);
         if(!SUCCEEDED(hr))
         {
            return FALSE;
         }
         AddSeparator(root, _T("\n "));
   
         _variant_t varXmlFileOut(tstrXmlFileOut);
         docPtr->documentElement->normalize();
         hr = docPtr->save(varXmlFileOut);
         
         if(SUCCEEDED(hr))
         {
            bResult = MoveOnFront(tstrXmlFileOut);
         }
         else
         {
            bResult = FALSE;
         }
         
         // error message
         if(bResult == FALSE)
         {
            ErrorMessage();
         }
      }
   }
   catch(...)
   {
      ErrorMessage();
      bResult = FALSE;
   }

   return bResult;

}
Exemplo n.º 12
0
//------------------------------------------------------------------------------
// void CreateMissionTreeToolBar()
//------------------------------------------------------------------------------
void MissionTreeToolBar::CreateMissionTreeToolBar()
{
   // Load toolbar icons
   GuiItemManager *guiManager = GuiItemManager::GetInstance();
   const int NUM_ICONS = 14;
   wxBitmap* bitmaps[NUM_ICONS];
   int index = -1;
   long bitmapType = wxBITMAP_TYPE_PNG;
   
   // Do not change the order, this order is how it appears in the toolbar
   
   guiManager->LoadIcon("mtc_ClearFilters", bitmapType, &bitmaps[++index], mtc_ClearFilters_xpm);
   guiManager->LoadIcon("mtc_LA", bitmapType, &bitmaps[++index], mtc_LA_xpm);
   guiManager->LoadIcon("mtc_L1", bitmapType, &bitmaps[++index], mtc_L1_xpm);
   guiManager->LoadIcon("mtc_L2", bitmapType, &bitmaps[++index], mtc_L2_xpm);
   guiManager->LoadIcon("mtc_L3", bitmapType, &bitmaps[++index], mtc_L3_xpm);
   guiManager->LoadIcon("mtc_IncPhysics", bitmapType, &bitmaps[++index], mtc_IncPhysics_xpm);
   guiManager->LoadIcon("mtc_IncSolver", bitmapType, &bitmaps[++index], mtc_IncSolver_xpm);
   guiManager->LoadIcon("mtc_IncScriptEvent", bitmapType, &bitmaps[++index], mtc_IncScriptEvent_xpm);
   guiManager->LoadIcon("mtc_IncControlFlow", bitmapType, &bitmaps[++index], mtc_IncControlFlow_xpm);
   guiManager->LoadIcon("mtc_ExcReport", bitmapType, &bitmaps[++index], mtc_ExcReport_xpm);
   guiManager->LoadIcon("mtc_ExcEquation", bitmapType, &bitmaps[++index], mtc_ExcEquation_xpm);
   guiManager->LoadIcon("mtc_ExcPlot", bitmapType, &bitmaps[++index], mtc_ExcPlot_xpm);
   guiManager->LoadIcon("mtc_ExcCall", bitmapType, &bitmaps[++index], mtc_ExcCall_xpm);
   guiManager->LoadIcon("mtc_CustomView", bitmapType, &bitmaps[++index], mtc_CustomView_xpm);
   
   index = 0;
   AddCheckTool(TOOL_CLEAR_FILTERS, wxT("ClearFilters"), *bitmaps[index],
                                 *bitmaps[index], wxT("Show All"));
   AddSeparator();
   ++index;
   AddCheckTool(TOOL_LEVEL_ALL, wxT("LevelA"), *bitmaps[index],
                                 *bitmaps[index], wxT("Expand All Levels"));
   ++index;
   AddCheckTool(TOOL_LEVEL_1, wxT("Level1"), *bitmaps[index],
                                 *bitmaps[index], wxT("Expand One Level"));
   ++index;
   AddCheckTool(TOOL_LEVEL_2, wxT("Level2"), *bitmaps[index],
                                 *bitmaps[index], wxT("Expand Two Levels"));
   ++index;
   AddCheckTool(TOOL_LEVEL_3, wxT("Level3"), *bitmaps[index],
                                 *bitmaps[index], wxT("Expand Three Levels"));
   AddSeparator();
   ++index;
   AddCheckTool(TOOL_INC_PHYSICS, wxT("IncPhysics"), *bitmaps[index],
                                 *bitmaps[index], wxT("Include Physics Related commands"));
   ++index;
   AddCheckTool(TOOL_INC_SOLVER, wxT("IncSolver"), *bitmaps[index],
                                 *bitmaps[index], wxT("Include Solver Related commands"));
   ++index;
   AddCheckTool(TOOL_INC_SCRIPT, wxT("IncScript"), *bitmaps[index],
                                 *bitmaps[index], wxT("Include ScriptEvent"));
   ++index;
   AddCheckTool(TOOL_INC_CONTROL, wxT("IncControl"), *bitmaps[index],
                                 *bitmaps[index], wxT("Include Control Flow"));
   AddSeparator();
   ++index;
   AddCheckTool(TOOL_EXC_REPORT, wxT("ExcReport"), *bitmaps[index],
                                 *bitmaps[index], wxT("Exclude Report"));
   ++index;
   AddCheckTool(TOOL_EXC_EQUATION, wxT("ExcEquation"), *bitmaps[index],
                                 *bitmaps[index], wxT("Exclude Equation"));
   ++index;
   AddCheckTool(TOOL_EXC_PLOT, wxT("ExcPlot"), *bitmaps[index],
                                 *bitmaps[index], wxT("Exclude Toggle, PenUp/Down, ClearPlot, and MarkPoint commands"));
   ++index;
   AddCheckTool(TOOL_EXC_CALL, wxT("ExcCall"), *bitmaps[index],
                                 *bitmaps[index], wxT("Exclude CallFunction, Save commands"));
   // Commented out until GMT-2855 is resolved
   // Commented out button create code until Customize View Window is completely fixed
   // TGG: 2012-07-31
   //AddSeparator();
   //++index;
   //AddTool(TOOL_CUSTOM_VIEW, wxT("CustomizeView"), *bitmaps[index],
   //                         wxT("Customize Mission Tree View"));
   Realize();
   
   for (int i = 0; i < NUM_ICONS; i++)
      delete bitmaps[i];
}
Exemplo n.º 13
0
// 重载加载XML节点函数,加载下层的Menu item信息
BOOL CDuiMenu::Load(TiXmlElement* pXmlElem, BOOL bLoadSubControl)
{
	SetRect(CRect(0, 0, m_nWidth, m_nHeight));

	__super::Load(pXmlElem, bLoadSubControl);

	if(pXmlElem == NULL)
	{
		return FALSE;
	}

	if(!bLoadSubControl)
	{
		// 不加载子控件
		return TRUE;
	}

	// 菜单窗口宽度设置为popup窗口的宽度
	m_nWidth = m_size.cx;

	// 创建窗口
	Create(m_pParent, m_point, m_uMessageID);
	
	// 加载下层的item节点信息(正常情况下都使用DlgPopup的Load控件方式加载菜单项,下面的解析比较少用到)
	int nIdIndex = 100;
	TiXmlElement* pItemElem = NULL;
	for (pItemElem = pXmlElem->FirstChildElement("item"); pItemElem != NULL; pItemElem=pItemElem->NextSiblingElement())
	{
		CStringA strId = pItemElem->Attribute("id");
		int nId = nIdIndex;
		if(strId != "")
		{
			nId = atoi(strId);
		}

		CStringA strType = pItemElem->Attribute("type");
		CStringA strName = pItemElem->Attribute("name");
		CStringA strImage = pItemElem->Attribute("image");
		CStringA strTitle = pItemElem->Attribute("title");
		
		if(strType == "separator")
		{
			// 分隔线也可以用图片的方式
			AddSeparator();
			continue;
		}
		CString strTitleU = CA2T(strTitle, CP_UTF8);
		if(strImage.Find(".") != -1)	// 加载图片文件
		{
			CString strImgFile = CA2T(strImage, CP_UTF8);
			AddMenu(strTitleU, nIdIndex, strImgFile);
		}else
		if(!strImage.IsEmpty())
		{
			UINT nResourceID = atoi(strImage);
			AddMenu(strTitleU, nIdIndex, nResourceID);
		}else
		{
			AddMenu(strTitleU, nIdIndex);
		}

		nIdIndex++;
	}

	// 刷新各菜单控件的位置
	SetMenuPoint();

	m_bInit = TRUE;

    return TRUE;
}
Exemplo n.º 14
0
 void Menu::AppendSeparator()
 {
     AddSeparator(-1);
 }
Exemplo n.º 15
0
/**
 * Constructor. Instantiate the command callbacks and construct the command
 * list.
 *
 * @param setScaleDialog Reference-counted handle on the Set S/T Scale dialog.
 * @param getInfoDialog  Reference-counted handle on the Get Info dialog.
 * @param genFuncDialog  Reference-counted handle on the General Function
 *                       dialog.
 */
MainMenu::MainMenu(SmartPointer<GenericDialog>& setScaleDialog,
                   SmartPointer<GenericDialog>& getInfoDialog,
                   SmartPointer<GenericDialog>& genFuncDialog) :
   _commandMeshVisitor(*this)
{
   // Like _commandMeshVisitor, the callbacks for the Help and About commands
   // also specify functions on this object. 
   const CommandCallbackMethod
      <MainMenu, &MainMenu::CommandHelp> commandHelp(*this);
   const CommandCallbackMethod
      <MainMenu, &MainMenu::CommandAbout> commandAbout(*this);

   // Start constructing the command list.
   BeginEntries();
   // First two commands summon dialogs.
   AddDialogShowEntry("Set S/T Scale...", "SetScale", setScaleDialog);
   AddDialogShowEntry("Get Info...", "GetInfo", getInfoDialog);
   AddSeparator();
   // Next command summons a dialog.
   AddDialogShowEntry("General Function...", "GeneralFunction", genFuncDialog);
   AddSeparator();
   // The next few groups of commands are all similar "preset function"
   // commands. They will each trigger the CommandMeshVisitor callback when
   // selected in the menu. CommandMeshVisitor needs a visitor object to apply
   // to the selected meshes, which we are specifying here. 
   AddMeshVisitorEntry("S&T Align Auto", "STMinMaxAlignAuto",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignAutoScale,
                                                MeshEntity::ALL_TEX_AXES)));
   AddMeshVisitorEntry("S Align Auto", "SMinMaxAlignAuto",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignAutoScale,
                                                MeshEntity::S_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("T Align Auto", "TMinMaxAlignAuto",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignAutoScale,
                                                MeshEntity::T_TEX_AXIS_ONLY)));
   AddSeparator();
   AddMeshVisitorEntry("S Align Stretch", "SMinMaxAlignStretch",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignStretch,
                                                MeshEntity::S_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("S Align Shrink", "SMinMaxAlignShrink",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignShrink,
                                                MeshEntity::S_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("T Align Stretch", "TMinMaxAlignStretch",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinMaxAlignStretch,
                                                MeshEntity::T_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("T Align Shrink", "TMinMaxAlignShrink",
                   SmartPointer<MeshVisitor>(
                      new PresetFuncVisitor(&MeshEntity::MinMaxAlignShrink,
                                            MeshEntity::T_TEX_AXIS_ONLY)));
   AddSeparator();
   AddMeshVisitorEntry("S Min Align", "SMinAlign",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinAlign,
                                                MeshEntity::S_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("S Max Align", "SMaxAlign",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MaxAlign,
                                                MeshEntity::S_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("T Min Align", "TMinAlign",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MinAlign,
                                                MeshEntity::T_TEX_AXIS_ONLY)));
   AddMeshVisitorEntry("T Max Align", "TMaxAlign",
                       SmartPointer<MeshVisitor>(
                          new PresetFuncVisitor(&MeshEntity::MaxAlign,
                                                MeshEntity::T_TEX_AXIS_ONLY)));
   AddSeparator();
   // These commands each invoke a unique callback when selected.
   AddEntry("Help...", "Help", commandHelp);
   AddEntry("About...", "About", commandAbout);
   // Done!
   EndEntries();
}
Exemplo n.º 16
0
int CTaskPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMFCTasksPane::OnCreate(lpCreateStruct) == -1)
        return -1;

    SetCaption (_T("Tasks Pane"));
    SetIconsList (IDB_TASKS, 16);

    EnableNavigationToolbar (TRUE);

    EnableWrapLabels (TRUE);
    EnableOffsetCustomControls (FALSE);

    m_nDocumentsGroup = AddGroup (_T("Open a document"), FALSE, TRUE);

    // Add MRU list:
    AddMRUFilesList (m_nDocumentsGroup);
    AddTask (m_nDocumentsGroup, _T("More Documents..."), 0, ID_FILE_OPEN);

    int nPage1Gr2 = AddGroup (_T("Custom group"));
    m_nUserColorGroup = nPage1Gr2;

    AddTask (nPage1Gr2, _T("Task 1"), 1, ID_TASK1);
    m_nUserColorTask = AddTask (nPage1Gr2, _T("Task 2"), 2, ID_TASK2);
    AddTask (nPage1Gr2, _T("Task 3"), 3, ID_TASK3);
    AddSeparator (nPage1Gr2);
    AddTask (nPage1Gr2, _T("Task 4"), 4, ID_TASK4);
    AddTask (nPage1Gr2, _T("Task 5"), 5, ID_TASK5);
    AddTask (nPage1Gr2, _T("Long task's name to see words wrap feature"), 6, ID_TASK6);

    int nPage1Gr3 = AddGroup (_T("Details"), TRUE);
    AddLabel (nPage1Gr3, _T("The Label contains text, which can be displayed in several lines. \n\nText can include line breaking characters \'\\n\' and &underline markers \'&&\'"));

    // Add second page:
    int nPage2 = AddPage (_T("Custom page"));

    int nPage2Gr1 = AddGroup (nPage2, _T("Tree Control"));

    if (!CreateTreeControl())
    {
        TRACE0("Failed to create the custom window\n");
        return -1;      // fail to create
    }

    const int nControlHeight = 65;

    AddWindow (nPage2Gr1, m_wndTree.GetSafeHwnd (), nControlHeight);
    AddTask (nPage2Gr1, _T("My favorites..."), 9, ID_TASK9);

    int nPage2Gr2 = AddGroup (nPage2, _T("Edit Control"));

    if (!CreateEditControl())
    {
        TRACE0("Failed to create the custom window\n");
        return -1;      // fail to create
    }

    AddWindow (nPage2Gr2, m_wndEdit.GetSafeHwnd (), nControlHeight);

    // Create tasks pane windows.
    // TODO: create your own tasks panes here:

    return 0;
}
//***********************************************************************************************	
void CBCGPRecentFilesListBox::FillList(LPCTSTR lpszSelectedPath/* = NULL*/)
{
	ASSERT(GetSafeHwnd() != NULL);

	ResetContent();
	ResetPins();
	
	m_lstCaptionIndexes.RemoveAll();

	m_nHighlightedItem = -1;
	m_bIsPinHighlighted = FALSE;

	int cyIcon = 32;

	if (globalData.GetRibbonImageScale () != 1.)
	{
		cyIcon = (int) (.5 + globalData.GetRibbonImageScale () * cyIcon);
	}

	int nItemHeight = max(cyIcon + 4, globalData.GetTextHeight () * 5 / 2);
	
	SetItemHeight(-1, nItemHeight);

	for (int i = 0; i < m_arIcons.GetSize(); i++)
	{
		HICON hIcon = m_arIcons[i];
		if (hIcon != NULL)
		{
			::DestroyIcon(hIcon);
		}
	}

	m_arIcons.RemoveAll();

	BOOL bHasPinnedItems = FALSE;

	// Add "pinned" items first
	if (g_pWorkspace != NULL)
	{
		const CStringArray& ar = g_pWorkspace->GetPinnedPaths(!m_bFoldersMode);

		for (int i = 0; i < (int)ar.GetSize(); i++)
		{
			int nIndex = AddItem(ar[i], 0, TRUE);
			if (nIndex >= 0 && lpszSelectedPath != NULL && ar[i] == lpszSelectedPath)
			{
				SetCurSel(nIndex);
			}

			if (nIndex >= 0)
			{
				bHasPinnedItems = TRUE;
			}
		}
	}

	if (bHasPinnedItems)
	{
		AddSeparator();
		m_arIcons.Add(NULL);
	}

	// Add MRU files:
	CRecentFileList* pMRUFiles = 
		((CBCGPApp*) AfxGetApp ())->m_pRecentFileList;

	if (pMRUFiles != NULL)
	{
		for (int i = 0; i < pMRUFiles->GetSize (); i++)
		{
			CString strPath = (*pMRUFiles)[i];

			int nIndex = AddItem(strPath, (ID_FILE_MRU_FILE1 + i));
			if (nIndex >= 0 && lpszSelectedPath != NULL && strPath == lpszSelectedPath)
			{
				SetCurSel(nIndex);
			}
		}
	}

	int nLastIndex = GetCount() - 1;
	if (nLastIndex >= 0 && IsSeparatorItem(nLastIndex))
	{
		DeleteString(nLastIndex);
	}
}
Exemplo n.º 18
0
// 重载加载XML节点函数,加载下层的Menu item信息
BOOL CDuiMenu::Load(DuiXmlNode pXmlElem, BOOL bLoadSubControl)
{
	SetRect(CRect(0, 0, m_nWidth, m_nHeight));

	__super::Load(pXmlElem, bLoadSubControl);

	if(pXmlElem == NULL)
	{
		return FALSE;
	}

	if(!bLoadSubControl)
	{
		// 不加载子控件
		return TRUE;
	}

	// 菜单窗口宽度设置为popup窗口的宽度
	m_nWidth = m_size.cx;

	// 创建窗口
	Create(m_pParent, m_point, m_uMessageID);
	
	// 加载下层的item节点信息(正常情况下都使用DlgPopup的Load控件方式加载菜单项,下面的解析比较少用到)
	int nIdIndex = 100;
	for (DuiXmlNode pItemElem = pXmlElem.child(_T("item")); pItemElem; pItemElem=pItemElem.next_sibling())
	{
		CString strId = pItemElem.attribute(_T("id")).value();
		int nId = nIdIndex;
		if(strId != _T(""))
		{
			nId = _ttoi(strId);
		}

		CString strType = pItemElem.attribute(_T("type")).value();
		CString strName = pItemElem.attribute(_T("name")).value();
		CString strImage = pItemElem.attribute(_T("image")).value();
		CString strTitle = pItemElem.attribute(_T("title")).value();
		
		if(strType == _T("separator"))
		{
			// 分隔线也可以用图片的方式
			AddSeparator();
			continue;
		}
		CString strTitleU = strTitle;
		if(strImage.Find(_T(".")) != -1)	// 加载图片文件
		{
			CString strImgFile = strImage;
			AddMenu(strTitleU, nIdIndex, strImgFile);
		}else
		if(!strImage.IsEmpty())
		{
			UINT nResourceID = _ttoi(strImage);
			AddMenu(strTitleU, nIdIndex, nResourceID);
		}else
		{
			AddMenu(strTitleU, nIdIndex);
		}

		nIdIndex++;
	}

	// 刷新各菜单控件的位置
	SetMenuPoint();

	m_bInit = TRUE;

    return TRUE;
}
Exemplo n.º 19
0
void TSessionLog::DoAddStartupInfo(TSessionData *Data)
{
  if (Data == nullptr)
  {
    AddSeparator();
    UnicodeString OS = WindowsVersionLong();
    AddToList(OS, WindowsProductName(), L" - ");
    ADF("NetBox %s (OS %s)", FConfiguration->GetProductVersionStr(), OS);
    {
      std::unique_ptr<THierarchicalStorage> Storage(FConfiguration->CreateConfigStorage());
      DebugAssert(Storage.get());
      ADF("Configuration: %s", Storage->GetSource());
    }

#if 0
    typedef BOOL (WINAPI * TGetUserNameEx)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize);
    HINSTANCE Secur32 = LoadLibrary(L"secur32.dll");
    TGetUserNameEx GetUserNameEx =
      (Secur32 != nullptr) ? reinterpret_cast<TGetUserNameEx>(::GetProcAddress(Secur32, "GetUserNameExW")) : nullptr;
    wchar_t UserName[UNLEN + 1];
    ULONG UserNameSize = _countof(UserName);
    if ((GetUserNameEx == nullptr) || DebugAlwaysFalse(!GetUserNameEx(NameSamCompatible, (LPWSTR)UserName, &UserNameSize)))
    {
      wcscpy_s(UserName, UNLEN, L"<Failed to retrieve username>");
    }
#endif // #if 0
    UnicodeString LogStr;
    if (FConfiguration->GetLogProtocol() <= 0)
    {
      LogStr = L"Normal";
    }
    else if (FConfiguration->GetLogProtocol() == 1)
    {
      LogStr = L"Debug 1";
    }
    else if (FConfiguration->GetLogProtocol() >= 2)
    {
      LogStr = L"Debug 2";
    }
#if 0
    if (FConfiguration->GetLogSensitive())
    {
      LogStr += L", Logging passwords";
    }
#endif // #if 0
    if (FConfiguration->GetLogMaxSize() > 0)
    {
      LogStr += FORMAT(L", Rotating after: %s", SizeToStr(FConfiguration->GetLogMaxSize()));
      if (FConfiguration->GetLogMaxCount() > 0)
      {
        LogStr += FORMAT(L", Keeping at most %d logs", FConfiguration->GetLogMaxCount());
      }
    }
#if 0
    ADF("Log level: %s", LogStr);
    ADF("Local account: %s", UserName);
#endif // #if 0
    ADF("Working directory: %s", GetCurrentDir());
    ADF("Process ID: %d", intptr_t(GetCurrentProcessId()));
#if 0
    ADF("Command-line: %s", GetCmdLineLog());
    if (FConfiguration->GetLogProtocol() >= 1)
    {
      AddOptions(GetGlobalOptions());
    }
#endif // #if 0
    ADF("Time zone: %s", GetTimeZoneLogString());
    if (!AdjustClockForDSTEnabled())
    {
      ADF("Warning: System option \"Automatically adjust clock for Daylight Saving Time\" is disabled, timestamps will not be represented correctly");
    }
#if 0
    ADF("Login time: %s", dt);
#endif // #if 0
    AddSeparator();
  }
  else
  {
#if 0
    ADF("Session name: %s (%s)", Data->GetSessionName(), Data->GetSource());
    ADF("Host name: %s (Port: %d)", Data->GetHostNameExpanded(), Data->GetPortNumber());
    ADF("User name: %s (Password: %s, Key file: %s, Passphrase: %s)",
      Data->GetUserNameExpanded(), LogSensitive(Data->GetPassword()),
      LogSensitive(Data->GetPublicKeyFile()), LogSensitive(Data->GetPassphrase()))
#endif // #if 0
    if (Data->GetUsesSsh())
    {
      ADF("Tunnel: %s", BooleanToEngStr(Data->GetTunnel()));
      if (Data->GetTunnel())
      {
        ADF("Tunnel: Host name: %s (Port: %d)", Data->GetTunnelHostName(), Data->GetTunnelPortNumber());
#if 0
        ADF("Tunnel: User name: %s (Password: %s, Key file: %s)",
          Data->GetTunnelUserName(), BooleanToEngStr(!Data->GetTunnelPassword().IsEmpty()),
          BooleanToEngStr(!Data->GetTunnelPublicKeyFile().IsEmpty()));
        ADF("Tunnel: Local port number: %d", Data->GetTunnelLocalPortNumber());
#endif // #if 0
      }
    }
    ADF("Transfer Protocol: %s", Data->GetFSProtocolStr());
    ADF("Code Page: %d", Data->GetCodePageAsNumber());
    if (Data->GetUsesSsh() || (Data->GetFSProtocol() == fsFTP))
    {
      TPingType PingType;
      intptr_t PingInterval;
      if (Data->GetFSProtocol() == fsFTP)
      {
        PingType = Data->GetFtpPingType();
        PingInterval = Data->GetFtpPingInterval();
      }
      else
      {
        PingType = Data->GetPingType();
        PingInterval = Data->GetPingInterval();
      }
      ADF("Ping type: %s, Ping interval: %d sec; Timeout: %d sec",
        EnumName(PingType, PingTypeNames), PingInterval, Data->GetTimeout());
      ADF("Disable Nagle: %s",
        BooleanToEngStr(Data->GetTcpNoDelay()));
    }
    TProxyMethod ProxyMethod = Data->GetActualProxyMethod();
    {
      UnicodeString fp = FORMAT(L"FTP proxy %d", Data->GetFtpProxyLogonType());
      ADF("Proxy: %s",
        (Data->GetFtpProxyLogonType() != 0) ? fp : EnumName(ProxyMethod, ProxyMethodNames));
    }
    if ((Data->GetFtpProxyLogonType() != 0) || (ProxyMethod != ::pmNone))
    {
      ADF("ProxyHostName: %s (Port: %d); ProxyUsername: %s; Passwd: %s",
        Data->GetProxyHost(), Data->GetProxyPort(),
        Data->GetProxyUsername(), BooleanToEngStr(!Data->GetProxyPassword().IsEmpty()));
      if (ProxyMethod == pmTelnet)
      {
        ADF("Telnet command: %s", Data->GetProxyTelnetCommand());
      }
      if (ProxyMethod == pmCmd)
      {
        ADF("Local command: %s", Data->GetProxyLocalCommand());
      }
    }
    if (Data->GetUsesSsh() || (Data->GetFSProtocol() == fsFTP))
    {
      ADF("Send buffer: %d", Data->GetSendBuf());
    }
    if (Data->GetUsesSsh())
    {
      ADF("SSH protocol version: %s; Compression: %s",
        Data->GetSshProtStr(), BooleanToEngStr(Data->GetCompression()));
      ADF("Bypass authentication: %s",
        BooleanToEngStr(Data->GetSshNoUserAuth()));
      ADF("Try agent: %s; Agent forwarding: %s; TIS/CryptoCard: %s; KI: %s; GSSAPI: %s",
        BooleanToEngStr(Data->GetTryAgent()), BooleanToEngStr(Data->GetAgentFwd()), BooleanToEngStr(Data->GetAuthTIS()),
        BooleanToEngStr(Data->GetAuthKI()), BooleanToEngStr(Data->GetAuthGSSAPI()));
      if (Data->GetAuthGSSAPI())
      {
        ADF("GSSAPI: Forwarding: %s",
          BooleanToEngStr(Data->GetGSSAPIFwdTGT()));
      }
      ADF("Ciphers: %s; Ssh2DES: %s",
        Data->GetCipherList(), BooleanToEngStr(Data->GetSsh2DES()));
      ADF("KEX: %s", Data->GetKexList());
      UnicodeString Bugs;
      for (intptr_t Index = 0; Index < BUG_COUNT; ++Index)
      {
        AddToList(Bugs, EnumName(Data->GetBug(static_cast<TSshBug>(Index)), AutoSwitchNames), L",");
      }
      ADF("SSH Bugs: %s", Bugs);
      ADF("Simple channel: %s", BooleanToEngStr(Data->GetSshSimple()));
      ADF("Return code variable: %s; Lookup user groups: %s",
        Data->GetDetectReturnVar() ? UnicodeString(L"Autodetect") : Data->GetReturnVar(),
        EnumName(Data->GetLookupUserGroups(), AutoSwitchNames));
      ADF("Shell: %s", Data->GetShell().IsEmpty() ? UnicodeString(L"default") : Data->GetShell());
      ADF("EOL: %s, UTF: %s", EnumName(Data->GetEOLType(), EOLTypeNames), EnumName(Data->GetNotUtf(), NotAutoSwitchNames)); // NotUtf duplicated in FTP branch
      ADF("Clear aliases: %s, Unset nat.vars: %s, Resolve symlinks: %s; Follow directory symlinks: %s",
        BooleanToEngStr(Data->GetClearAliases()), BooleanToEngStr(Data->GetUnsetNationalVars()),
        BooleanToEngStr(Data->GetResolveSymlinks()), BooleanToEngStr(Data->GetFollowDirectorySymlinks()));
      ADF("LS: %s, Ign LS warn: %s, Scp1 Comp: %s",
        Data->GetListingCommand(),
        BooleanToEngStr(Data->GetIgnoreLsWarnings()),
        BooleanToEngStr(Data->GetScp1Compatibility()));
    }
    if ((Data->GetFSProtocol() == fsSFTP) || (Data->GetFSProtocol() == fsSFTPonly))
    {
      UnicodeString Bugs;
      for (intptr_t Index = 0; Index < SFTP_BUG_COUNT; ++Index)
      {
        AddToList(Bugs, EnumName(Data->GetSFTPBug(static_cast<TSftpBug>(Index)), AutoSwitchNames), L",");
      }
      ADF("SFTP Bugs: %s", Bugs);
      ADF("SFTP Server: %s", Data->GetSftpServer().IsEmpty() ? UnicodeString(L"default") : Data->GetSftpServer());
    }
    bool FtpsOn = false;
    if (Data->GetFSProtocol() == fsFTP)
    {
      ADF("UTF: %s", EnumName(Data->GetNotUtf(), NotAutoSwitchNames)); // duplicated in UsesSsh branch
      UnicodeString Ftps;
      switch (Data->GetFtps())
      {
      case ftpsImplicit:
        Ftps = L"Implicit TLS/SSL";
        FtpsOn = true;
        break;

      case ftpsExplicitSsl:
        Ftps = L"Explicit SSL/TLS";
        FtpsOn = true;
        break;

      case ftpsExplicitTls:
        Ftps = L"Explicit TLS/SSL";
        FtpsOn = true;
        break;

      default:
        DebugAssert(Data->GetFtps() == ftpsNone);
        Ftps = L"None";
        break;
      }
      // kind of hidden option, so do not reveal it unless it is set
      if (Data->GetFtpTransferActiveImmediately() != asAuto)
      {
        ADF("Transfer active immediately: %s", EnumName(Data->GetFtpTransferActiveImmediately(), AutoSwitchNames));
      }
      ADF("FTPS: %s [Client certificate: %s]",
        Ftps, LogSensitive(Data->GetTlsCertificateFile()));
      ADF("FTP: Passive: %s [Force IP: %s]; MLSD: %s [List all: %s]; HOST: %s",
        BooleanToEngStr(Data->GetFtpPasvMode()),
        EnumName(Data->GetFtpForcePasvIp(), AutoSwitchNames),
        EnumName(Data->GetFtpUseMlsd(), AutoSwitchNames),
        EnumName(Data->GetFtpListAll(), AutoSwitchNames),
        EnumName(Data->GetFtpHost(), AutoSwitchNames));
    }
    if (Data->GetFSProtocol() == fsWebDAV)
    {
      FtpsOn = (Data->GetFtps() != ftpsNone);
      ADF("HTTPS: %s [Client certificate: %s]",
        BooleanToEngStr(FtpsOn), LogSensitive(Data->GetTlsCertificateFile()));
    }
    if (FtpsOn)
    {
      if (Data->GetFSProtocol() == fsFTP)
      {
        ADF("Session reuse: %s", BooleanToEngStr(Data->GetSslSessionReuse()));
      }
      ADF("TLS/SSL versions: %s-%s", GetTlsVersionName(Data->GetMinTlsVersion()), GetTlsVersionName(Data->GetMaxTlsVersion()));
    }
    ADF("Local directory: %s, Remote directory: %s, Update: %s, Cache: %s",
      Data->GetLocalDirectory().IsEmpty() ? UnicodeString(L"default") : Data->GetLocalDirectory(),
      Data->GetRemoteDirectory().IsEmpty() ? UnicodeString(L"home") : Data->GetRemoteDirectory(),
      BooleanToEngStr(Data->GetUpdateDirectories()),
      BooleanToEngStr(Data->GetCacheDirectories()));
    ADF("Cache directory changes: %s, Permanent: %s",
      BooleanToEngStr(Data->GetCacheDirectoryChanges()),
      BooleanToEngStr(Data->GetPreserveDirectoryChanges()));
    ADF("Recycle bin: Delete to: %s, Overwritten to: %s, Bin path: %s",
      BooleanToEngStr(Data->GetDeleteToRecycleBin()),
      BooleanToEngStr(Data->GetOverwrittenToRecycleBin()),
      Data->GetRecycleBinPath());
    if (Data->GetTrimVMSVersions())
    {
      ADF("Trim VMS versions: %s",
        BooleanToEngStr(Data->GetTrimVMSVersions()));
    }
    UnicodeString TimeInfo;
    if ((Data->GetFSProtocol() == fsSFTP) || (Data->GetFSProtocol() == fsSFTPonly) || (Data->GetFSProtocol() == fsSCPonly) || (Data->GetFSProtocol() == fsWebDAV))
    {
      AddToList(TimeInfo, FORMAT(L"DST mode: %s", EnumName(ToInt(Data->GetDSTMode()), DSTModeNames)), L";");
    }
    if ((Data->GetFSProtocol() == fsSCPonly) || (Data->GetFSProtocol() == fsFTP))
    {
      intptr_t TimeDifferenceMin = TimeToMinutes(Data->GetTimeDifference());
      AddToList(TimeInfo, FORMAT(L"Timezone offset: %dh %dm", TimeDifferenceMin / MinsPerHour, TimeDifferenceMin % MinsPerHour), L";");
    }
    ADSTR(TimeInfo);

    if (Data->GetFSProtocol() == fsWebDAV)
    {
      ADF("Compression: %s",
        BooleanToEngStr(Data->GetCompression()));
    }

    AddSeparator();
  }
}
Exemplo n.º 20
0
// Callback-функция получения таблиц символов
BOOL WINAPI EnumCodePagesProc(const wchar_t *lpwszCodePage)
{
	uintptr_t codePage = _wtoi(lpwszCodePage);

	// Для функции проверки нас не интересует информация о кодовых страницах отличных от проверяемой
	if (CallbackCallSource == CodePageCheck && codePage != currentCodePage)
		return TRUE;

	// Получаем информацию о кодовой странице. Если информацию по какой-либо причине получить не удалось, то
	// для списков прожолжаем енумерацию, а для процедуры же проверки поддерживаемости кодовой страницы выходим
	CPINFOEX cpiex;
	if (!GetCodePageInfo(codePage, cpiex))
		return CallbackCallSource == CodePageCheck ? FALSE : TRUE;

	// Для функции проверки поддерживаемости кодовой страницы мы прошли все проверки и можем выходить
	if (CallbackCallSource == CodePageCheck)
	{
		CodePageSupported = true;
		return FALSE;
	}

	// Формируем имя таблиц символов
	bool IsCodePageNameCustom = false;
	wchar_t *codePageName = FormatCodePageName(_wtoi(lpwszCodePage), cpiex.CodePageName, sizeof(cpiex.CodePageName)/sizeof(wchar_t), IsCodePageNameCustom);
	// Получаем признак выбранности таблицы символов
	int selectType = 0;
	GeneralCfg->GetValue(FavoriteCodePagesKey, lpwszCodePage, &selectType, 0);

	// Добавляем таблицу символов либо в нормальные, либо в выбранные таблицы симовлов
	if (selectType & CPST_FAVORITE)
	{
		// Если надо добавляем разделитель между выбранными и нормальными таблицами симовлов
		if (!favoriteCodePages)
			AddSeparator(MSG(MGetCodePageFavorites),GetItemsCount()-normalCodePages-(normalCodePages?1:0));

		// Добавляем таблицу символов в выбранные
		AddCodePage(
		    codePageName,
		    codePage,
		    GetCodePageInsertPosition(
		        codePage,
		        GetItemsCount()-normalCodePages-favoriteCodePages-(normalCodePages?1:0),
		        favoriteCodePages
		    ),
		    true,
		    selectType & CPST_FIND ? true : false,
			IsCodePageNameCustom
		);
		// Увеличиваем счётчик выбранных таблиц символов
		favoriteCodePages++;
	}
	else if (CallbackCallSource == CodePagesFill || !Opt.CPMenuMode)
	{
		// добавляем разделитель между стандартными и системными таблицами символов
		if (!favoriteCodePages && !normalCodePages)
			AddSeparator(MSG(MGetCodePageOther));

		// Добавляем таблицу символов в нормальные
		AddCodePage(
		    codePageName,
		    codePage,
		    GetCodePageInsertPosition(
		        codePage,
		        GetItemsCount()-normalCodePages,
		        normalCodePages
		    ),
			true,
			false,
			IsCodePageNameCustom
		);
		// Увеличиваем счётчик выбранных таблиц символов
		normalCodePages++;
	}

	return TRUE;
}
Exemplo n.º 21
0
GtkWidget * create_PopUpMenu( void )
{
    GtkWidget * window1;
    GtkWidget * Menu = NULL;
    GtkWidget * SubMenu = NULL;
    GtkWidget * MenuItem = NULL;
    GtkWidget * H, * N, * D, * F;
    demuxer_t *demuxer = mpctx_get_demuxer(guiInfo.mpcontext);
    mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
    int global_sub_size = mpctx_get_global_sub_size(guiInfo.mpcontext);

    Menu=gtk_menu_new();
    gtk_widget_realize (Menu);
    window1 = gtk_widget_get_toplevel(Menu);


    AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_MENU_AboutMPlayer"     ", evAbout );
    AddSeparator( Menu );
    SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open );
    AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile"    ", evLoadPlay );
#ifdef CONFIG_CDDA
    AddMenuItem( window1, (const char*)playcd_xpm, SubMenu,MSGTR_MENU_PlayCD, evPlayCD );
    CDSubMenu=AddSubMenu( window1, (const char*)cd_xpm, Menu,MSGTR_MENU_CD );
    AddMenuItem( window1, (const char*)playcd_xpm, CDSubMenu,MSGTR_MENU_PlayDisc,evPlayCD );
    AddSeparator( CDSubMenu );
    CDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, CDSubMenu,MSGTR_MENU_Titles );
    if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_CDDA ) )
    {
        char tmp[32];
        int i;
        for ( i=1; i <= guiInfo.Tracks; i++ )
        {
            snprintf( tmp,32,MSGTR_MENU_Title,i );
            //AddMenuItem( CDTitleMenu,tmp,( i << 16 ) + ivSetCDTrack );
            AddMenuCheckItem(window1, (const char*)empty1px_xpm, CDTitleMenu,tmp, guiInfo.Track == i, ( i << 16 ) + ivSetCDTrack );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, CDTitleMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
#endif
#ifdef CONFIG_VCD
    AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
    VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD );
    AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
    AddSeparator( VCDSubMenu );
    VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
    if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_VCD ) )
    {
        char tmp[32];
        int i;
        for ( i=1; i < guiInfo.Tracks; i++ )
        {
            snprintf( tmp,32,MSGTR_MENU_Title,i );
            //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + ivSetVCDTrack );
            AddMenuCheckItem(window1, (const char*)empty1px_xpm, VCDTitleMenu,tmp, guiInfo.Track == i + 1, ( ( i + 1 ) << 16 ) + ivSetVCDTrack );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
#endif
#ifdef CONFIG_DVDREAD
    AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
    DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD );
    AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc"    ", evPlayDVD );
//    AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
    AddSeparator( DVDSubMenu );
    DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
    if ( guiInfo.Tracks && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
    {
        char tmp[32];
        int i;
        for ( i=1 ; i<= guiInfo.Tracks; i++ )
        {
            snprintf( tmp,32,MSGTR_MENU_Title,i);
            AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
                              guiInfo.Track == i,
                              (i << 16) + ivSetDVDTitle );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
    DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
    if ( guiInfo.Chapters && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
    {
        char tmp[32];
        int i;
        for ( i=1; i <= guiInfo.Chapters; i++ )
        {
            snprintf( tmp,32,MSGTR_MENU_Chapter,i );
            AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.Chapter == i,
                              ( i << 16 ) + ivSetDVDChapter );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
    DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)audiolang_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages );
    if ( guiInfo.AudioStreams && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
    {
        char tmp[64];
        int i, id = demuxer ? demuxer->audio->id : audio_id;
        for ( i=0; i < guiInfo.AudioStreams; i++ )
        {
            snprintf( tmp,64,"%s - %s %s",GetLanguage( guiInfo.AudioStream[i].language ),
                      ChannelTypes[ guiInfo.AudioStream[i].type ],
                      ChannelNumbers[ guiInfo.AudioStream[i].channels ] );
//	 if ( id == -1 ) id=audio_id; //guiInfo.AudioStream[i].id;
            AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp,
                              id == guiInfo.AudioStream[i].id,
                              ( guiInfo.AudioStream[i].id << 16 ) + ivSetDVDAudio );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
    DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)sublang_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages );
    if ( guiInfo.Subtitles && ( guiInfo.StreamType == STREAMTYPE_DVD ) )
    {
        char tmp[64];
        int i;
        AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + ivSetDVDSubtitle );
        for ( i=0; i < guiInfo.Subtitles; i++ )
        {
            av_strlcpy( tmp,GetLanguage( guiInfo.Subtitle[i].language ),sizeof(tmp) );
            AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp,
                              dvdsub_id == guiInfo.Subtitle[i].id,
                              ( guiInfo.Subtitle[i].id << 16 ) + ivSetDVDSubtitle );
        }
    }
    else
    {
        MenuItem=AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone );
        gtk_widget_set_sensitive( MenuItem,FALSE );
    }
#endif
    AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evLoadURL );
    AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle"   ", evLoadSubtitle );
    AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
    AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
    SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing );
    AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play"        ", evPlay );
    AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause );
    AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_MENU_Stop, evStop );
    AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext );
    AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev );
//    AddSeparator( SubMenu );
//    AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
//    AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
//    AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
//    AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
//   SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
//    AddMenuItem( SubMenu,MSGTR_MENU_NormalSize"      ", evNormalSize );
//    AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
//    AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );

//  if ( guiInfo.Playing )
    {
        AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio );
        AddMenuItem( window1, (const char*)aspect11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect );
        AddMenuItem( window1, (const char*)aspect169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect );
        AddMenuItem( window1, (const char*)aspect43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect );
        AddMenuItem( window1, (const char*)aspect235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
    }

    if ( guiInfo.Playing && demuxer && guiInfo.StreamType != STREAMTYPE_DVD )
    {
        int i,c = 0;

        for ( i=0; i < MAX_A_STREAMS; i++ )
            if ( demuxer->a_streams[i] ) c++;

        if ( c > 1 )
        {
            SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack );
            for ( i=0; i < MAX_A_STREAMS; i++ )
                if ( demuxer->a_streams[i] )
                {
                    int aid = ((sh_audio_t *)demuxer->a_streams[i])->aid;
                    int selected_id = (audio_id == aid || (audio_id == -1 && aid == demuxer_default_audio_track(mpctx_get_demuxer(guiInfo.mpcontext))));
                    char tmp[32];
                    snprintf( tmp,32,MSGTR_MENU_Track,aid );
                    AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu,tmp,selected_id,( aid << 16 ) + ivSetAudio );
                }
        }

        for ( c=0,i=0; i < MAX_V_STREAMS; i++ )
            if ( demuxer->v_streams[i] ) c++;

        if ( c > 1 )
        {
            SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack );
            for ( i=0; i < MAX_V_STREAMS; i++ )
                if ( demuxer->v_streams[i] )
                {
                    int vid = ((sh_video_t *)demuxer->v_streams[i])->vid;
                    char tmp[32];
                    snprintf( tmp,32,MSGTR_MENU_Track,vid );
                    AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu,tmp,video_id == vid,( vid << 16 ) + ivSetVideo );
                }
        }
    }

    /* cheap subtitle switching for non-DVD streams */
    if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD )
    {
        int i;
        SubMenu=AddSubMenu( window1, (const char*)subtitle_xpm, Menu, MSGTR_MENU_Subtitles );
        AddMenuCheckItem( window1, (const char*)empty1px_xpm, SubMenu, MSGTR_MENU_None, guiInfo.mpcontext->global_sub_pos == -1, (-1 << 16) + ivSetSubtitle );
        for ( i=0; i < global_sub_size; i++ )
        {
            char tmp[32];
            snprintf( tmp, 32, MSGTR_MENU_Track, i );
            AddMenuCheckItem( window1,(const char*)empty1px_xpm,SubMenu,tmp,guiInfo.mpcontext->global_sub_pos == i,( i << 16 ) + ivSetSubtitle );
        }
    }

    AddSeparator( Menu );
    MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute );
    if ( !guiInfo.AudioChannels ) gtk_widget_set_sensitive( MenuItem,FALSE );
    AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlaylist );
    AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
    AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences );
    AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_Equalizer, evEqualizer );

    if ( guiInfo.VideoWindow )
    {
        int b1 = 0, b2 = 0, b_half = 0;
        AddSeparator( Menu );
        if ( !guiApp.videoWindow.isFullScreen && guiInfo.Playing )
        {
            if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth * 2 )&&
                    ( guiApp.videoWindow.Height == guiInfo.VideoHeight * 2 ) ) b2=1;
            else if ( ( guiApp.videoWindow.Width == guiInfo.VideoWidth / 2 ) &&
                      ( guiApp.videoWindow.Height == guiInfo.VideoHeight / 2 ) ) b_half=1;
            else b1=1;
        } else b1=!guiApp.videoWindow.isFullScreen;
        H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize );
        N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize"      ",b1,evNormalSize );
        D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
        F=AddMenuCheckItem( window1, (const char*)full_xpm, Menu,MSGTR_MENU_FullScreen,guiApp.videoWindow.isFullScreen,evFullScreen );
        if ( !guiInfo.Playing )
        {
            gtk_widget_set_sensitive( H,FALSE );
            gtk_widget_set_sensitive( N,FALSE );
            gtk_widget_set_sensitive( D,FALSE );
            gtk_widget_set_sensitive( F,FALSE );
        }
    }

    AddSeparator( Menu );
    AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit );

    return Menu;
}
Exemplo n.º 22
0
void EditToolBar::MakeButtons()
{
   wxColour newColour =
       wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
   wxColour baseColour = wxColour(204, 204, 204);

   wxImage *upOriginal = new wxImage(wxBitmap(Up).ConvertToImage());
   wxImage *downOriginal = new wxImage(wxBitmap(Down).ConvertToImage());
   wxImage *hiliteOriginal = new wxImage(wxBitmap(Hilite).ConvertToImage());

#ifdef __WXGTK__
   /* dmazzoni: hack to get around XPM color bugs in GTK */
   unsigned char *data = upOriginal->GetData();
   baseColour.Set(data[28 * 3], data[28 * 3 + 1], data[28 * 3 + 2]);
#endif

   upImage = ChangeImageColour(upOriginal, baseColour, newColour);
   downImage = ChangeImageColour(downOriginal, baseColour, newColour);
   hiliteImage = ChangeImageColour(hiliteOriginal, baseColour, newColour);

   /* Buttons */

   mButtonPos = 0;

   AddButton(Cut, CutDisabled, CutAlpha, ETBCutID,
             _("Cut"));
   AddButton(Copy, CopyDisabled, CopyAlpha, ETBCopyID,
             _("Copy"));
   AddButton(Paste, PasteDisabled, PasteAlpha, ETBPasteID,
             _("Paste"));
   AddButton(Trim, TrimDisabled, TrimAlpha, ETBTrimID,
             _("Trim outside selection"));
   AddButton(Silence, SilenceDisabled, SilenceAlpha, ETBSilenceID,
             _("Silence selection"));

   AddSeparator();
   AddButton(Undo, UndoDisabled, UndoAlpha, ETBUndoID, _("Undo"));
   AddButton(Redo, RedoDisabled, RedoAlpha, ETBRedoID, _("Redo"));
   AddSeparator();

   AddButton(ZoomIn, ZoomInDisabled, ZoomInAlpha, ETBZoomInID,
             _("Zoom In"));
   AddButton(ZoomOut, ZoomOutDisabled, ZoomOutAlpha, ETBZoomOutID,
             _("Zoom Out"));

   #if 0 // Disabled for version 1.2.0 since it doesn't work quite right...
   AddButton(ZoomToggle, ZoomToggleDisabled, ZoomToggleAlpha, ETBZoomToggleID,
             _("Zoom Toggle"));
   #endif

   AddButton(ZoomSel, ZoomSelDisabled, ZoomSelAlpha, ETBZoomSelID,
             _("Fit selection in window"));
   AddButton(ZoomFit, ZoomFitDisabled, ZoomFitAlpha, ETBZoomFitID,
             _("Fit project in window"));

   mButtons[ETBZoomInID]->SetEnabled(false);
   mButtons[ETBZoomOutID]->SetEnabled(false);

   #if 0 // Disabled for version 1.2.0 since it doesn't work quite right...
   mButtons[ETBZoomToggleID]->SetEnabled(false);
   #endif

   mButtons[ETBZoomSelID]->SetEnabled(false);
   mButtons[ETBZoomFitID]->SetEnabled(false);
   mButtons[ETBPasteID]->SetEnabled(false);

   delete upImage;
   delete downImage;
   delete hiliteImage;
   delete upOriginal;
   delete downOriginal;
   delete hiliteOriginal;
}
Exemplo n.º 23
0
/*******************************************************************************
 *	Slot function. Translates command object recevied from the parser thread
 * 	to appropriate function call.
 * ****************************************************************************/
void DialogBox::ExecuteCommand(DialogCommand command)
{
	QWidget* widget=NULL;

	if(empty)
		{
			ClearDialog();
			empty=false;
		}
	switch(command.command & DialogCommand::command_mask)
		{
			case DialogCommand::add:

				if(command.command & DialogCommand::option_space & DialogCommand::option_mask)
					{
						// Seems sscanf %d in some versions of standard C library has a bug
						// returning 32k on sero-size strings
						if(command.GetText()[0])
							{
								int size;
								sscanf(command.GetText(), "%d", &size);
								AddSpace(size);
							}
						else AddSpace();
						break;
					}

				if(command.command & DialogCommand::option_stretch & DialogCommand::option_mask)
					{
						AddStretch();
						break;
					}

				switch(command.control & ~DialogCommand::property_mask)
					{
						case DialogCommand::label:
							AddLabel(command.GetTitle(), command.GetName(),
								command.control & DialogCommand::property_picture & DialogCommand::property_mask ? DialogBox::pixmap :
										command.control & DialogCommand::property_animation & DialogCommand::property_mask ? DialogBox::movie :
										DialogBox::text);
							break;
						case DialogCommand::groupbox:
							AddGroupbox(command.GetTitle(), command.GetName(),
								command.control & DialogCommand::property_vertical & DialogCommand::property_mask,
								command.control & DialogCommand::property_checkable & DialogCommand::property_mask,
								command.control & DialogCommand::property_checked & DialogCommand::property_mask);
							break;
						case DialogCommand::frame:
							AddFrame(command.GetTitle(),
								command.control & DialogCommand::property_vertical & DialogCommand::property_mask,
								command.control);
							break;
						case DialogCommand::pushbutton:
							AddPushbutton(command.GetTitle(), command.GetName(),
								command.control & DialogCommand::property_apply & DialogCommand::property_mask,
								command.control & DialogCommand::property_exit & DialogCommand::property_mask,
								command.control & DialogCommand::property_default & DialogCommand::property_mask);
							break;
						case DialogCommand::checkbox:
							AddCheckbox(command.GetTitle(), command.GetName(),
								command.control & DialogCommand::property_checked & DialogCommand::property_mask);
							break;
						case DialogCommand::radiobutton:
							AddRadiobutton(command.GetTitle(), command.GetName(),
								command.control & DialogCommand::property_checked & DialogCommand::property_mask);
							break;
						case DialogCommand::textbox:
							AddTextbox(command.GetTitle(), command.GetName(),
								command.GetText(),
								command.GetAuxText(),
								command.control & DialogCommand::property_password & DialogCommand::property_mask);
							break;
						case DialogCommand::listbox:
							AddListbox(command.GetTitle(), command.GetName(),
							command.control & DialogCommand::property_activation & DialogCommand::property_mask,
							command.control & DialogCommand::property_selection & DialogCommand::property_mask);
							break;
						case DialogCommand::combobox:
							AddCombobox(command.GetTitle(), command.GetName(),
							command.control & DialogCommand::property_editable & DialogCommand::property_mask,
							command.control & DialogCommand::property_selection & DialogCommand::property_mask);
							break;
						case DialogCommand::item:
							AddItem(command.GetTitle(), command.GetName(),
							command.control & DialogCommand::property_current & DialogCommand::property_mask);
							break;
						case DialogCommand::separator:
							AddSeparator(command.GetTitle(),
								command.control & DialogCommand::property_vertical & DialogCommand::property_mask,
								command.control);
							break;
						case DialogCommand::progressbar:
							AddProgressbar(command.GetTitle(),
								command.control & DialogCommand::property_vertical & DialogCommand::property_mask,
								command.control & DialogCommand::property_busy & DialogCommand::property_mask);
							break;
						case DialogCommand::slider:
							{
								int min(0), max(100);
								if(command.GetName()[0]) sscanf(command.GetName(), "%d", &min);
								if(command.GetText()[0]) sscanf(command.GetText(), "%d", &max);
								AddSlider(command.GetTitle(),
									command.control & DialogCommand::property_vertical & DialogCommand::property_mask,
									min, max);
							}
							break;
						case DialogCommand::textview:
							AddTextview(command.GetTitle(), command.GetName());
							break;
						case DialogCommand::tabs:
							AddTabs(command.GetTitle(), command.control);
							break;
						case DialogCommand::page:
							AddPage(command.GetTitle(), command.GetName(), command.GetText(),
							command.control & DialogCommand::property_current & DialogCommand::property_mask);
							break;
					}
				break;
			case DialogCommand::clear:
				Clear(command.GetName());
				break;
			case DialogCommand::end:
				switch(command.control & ~DialogCommand::property_mask)
					{
						case DialogCommand::groupbox:
						case DialogCommand::frame:
							EndGroup();
							break;
						case DialogCommand::listbox:
						case DialogCommand::combobox:
							EndList();
							break;
						case DialogCommand::tabs:
							EndTabs();
							break;
						case DialogCommand::page:
							EndPage();
							break;
						case DialogCommand::widget_mask:	// none type mentioned
							if(current_view) EndList();
							else if(group_layout) EndGroup();
							else if(current_tab_widget)
								{
									if(current_tab_widget->indexOf(current_layout->parentWidget())==-1) EndTabs();
									else EndPage();
								}
							break;
					}
				break;
			case DialogCommand::step:
				if(command.command & DialogCommand::option_vertical & DialogCommand::option_mask) StepVertical();
				else StepHorizontal();
				break;
			case DialogCommand::set:
				if(command.GetName()[0])
					{
						if(!(widget=FindWidget(command.GetName()))) break;
					}
				else widget=this;

				if(command.command & DialogCommand::option_enabled & DialogCommand::option_mask)
					SetEnabled(widget, true);

				if(command.command & DialogCommand::option_focus & DialogCommand::option_mask)
					{
						QTimer::singleShot(0, widget, SLOT(setFocus()));

						// select text for QLineEdit objects
						// selectedText property is not writable and this must be done in the class specific way
						if(QWidget* proxywidget=widget->focusProxy())
							{
								switch(WidgetType(proxywidget))
									{
										case DialogCommand::combobox:
											proxywidget=((QComboBox*)proxywidget)->lineEdit();
											break;
										case DialogCommand::textbox:
											break;
										default:
											proxywidget=NULL;
											break;
									}
								if(proxywidget) ((QLineEdit*)proxywidget)->selectAll();
							}
					}

				// see http://doc.qt.io/qt-4.8/stylesheet.html for reference
				if(command.command & DialogCommand::option_stylesheet & DialogCommand::option_mask)
					{
						widget->setStyleSheet(command.GetText());
						if(QWidget* proxywidget=widget->focusProxy())
							proxywidget->setStyleSheet(command.GetText());
					}

				if(command.command & DialogCommand::option_visible & DialogCommand::option_mask)
					{
						widget->show();
						if(QWidget* proxywidget=widget->focusProxy()) proxywidget->show();
					}

				if(command.control) SetOptions(widget, command.control, command.control, command.GetText());

				// setting of some properties (calls like show and hide) generates events which are optimised next
				// or sets widget attributes which might impact next calls
				// to avoid races and to ensure the command is executed as expected we process all events that
				// have been generated:
				QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
				break;
			case DialogCommand::unset:
				if(command.GetName()[0])
					{
						if(!(widget=FindWidget(command.GetName()))) break;
					}
				else widget=this;

				if(command.command & DialogCommand::option_enabled & DialogCommand::option_mask)
					SetEnabled(widget, false);

				// see http://doc.qt.io/qt-4.8/stylesheet.html for reference
				if(command.command & DialogCommand::option_stylesheet & DialogCommand::option_mask)
					{
						// rarely it was seen this fails (unset stylesheet or set it to empty string)
						// hopefully this was caused by the race which is now fixed
						// (queued signaling between threads and optimisation of queued GUI events)
						widget->setStyleSheet(QString());
						if(QWidget* proxywidget=widget->focusProxy())
							proxywidget->setStyleSheet(QString());
					}

				if(command.command & DialogCommand::option_visible & DialogCommand::option_mask)
					{
						widget->hide();
						if(QWidget* proxywidget=widget->focusProxy()) proxywidget->hide();
					}

				if(command.control) SetOptions(widget, 0, command.control, NULL);

				// setting of some properties (calls like show and hide) generates events which are optimised next
				// or sets widget attributes which might impact next calls
				// to avoid races and to ensure the command is executed as expected we process all events that
				// have been generated:
				QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
				break;
			case DialogCommand::remove:
				RemoveWidget(command.GetName());
				break;
			case DialogCommand::position:
				Position(command.GetText(),
							command.command & DialogCommand::option_behind & DialogCommand::option_mask,
							command.command & DialogCommand::option_onto & DialogCommand::option_mask);
				break;
			case DialogCommand::query:
				Report();
				break;
			case DialogCommand::noop:
			default:
				;
		}
	// clean up after possible FindWidget call
	chosen_view=NULL;
	chosen_row_flag=false;
}
Exemplo n.º 24
0
// Callback-функция получения таблиц символов
BOOL __stdcall EnumCodePagesProc(const wchar_t *lpwszCodePage)
{
	UINT codePage = _wtoi(lpwszCodePage);

	// Получаем информацию о кодовой странице. Если информацию по какой-либо причине получить не удалось, то
	// для списков продолжаем енумерацию, а для процедуры же проверки поддерживаемости кодовой страницы выходим
	CPINFOEX cpiex;
	if (!GetCodePageInfo(codePage, cpiex)) {
		return CallbackCallSource == CodePageCheck ? FALSE : TRUE;
	}

    	if (IsStandardCodePage(codePage)) {
    		return TRUE; // continue
    	}

	// Формируем имя таблиц символов
	bool IsCodePageNameCustom = false;
	wchar_t *codePageName = FormatCodePageName(_wtoi(lpwszCodePage), cpiex.CodePageName, sizeof(cpiex.CodePageName)/sizeof(wchar_t), IsCodePageNameCustom);
	// Получаем признак выбранности таблицы символов
	int selectType = 0;
	GetRegKey(FavoriteCodePagesKey, lpwszCodePage, selectType, 0);

	// Добавляем таблицу символов либо в нормальные, либо в выбранные таблицы симовлов
	if (selectType & CPST_FAVORITE)
	{
		// Если надо добавляем разделитель между выбранными и нормальными таблицами симовлов
		if (!favoriteCodePages)
			AddSeparator(MSG(MGetCodePageFavorites),GetItemsCount()-normalCodePages-(normalCodePages?1:0));

		// Добавляем таблицу символов в выбранные
		AddCodePage(
		    codePageName,
		    codePage,
		    GetCodePageInsertPosition(
		        codePage,
		        GetItemsCount()-normalCodePages-favoriteCodePages-(normalCodePages?1:0),
		        favoriteCodePages
		    ),
		    true,
		    selectType & CPST_FIND ? true : false,
			IsCodePageNameCustom
		);
		// Увеличиваем счётчик выбранных таблиц символов
		favoriteCodePages++;
	}
	else if (CallbackCallSource == CodePagesFill || Opt.CPMenuMode)
	{
		// добавляем разделитель между стандартными и системными таблицами символов
		if (!favoriteCodePages && !normalCodePages)
			AddSeparator(MSG(MGetCodePageOther));

		// Добавляем таблицу символов в нормальные
		AddCodePage(
		    codePageName,
		    codePage,
		    GetCodePageInsertPosition(
		        codePage,
		        GetItemsCount()-normalCodePages,
		        normalCodePages
		    ),
			true,
			false,
			IsCodePageNameCustom
		);
		// Увеличиваем счётчик выбранных таблиц символов
		normalCodePages++;
	}

	return TRUE;
}
Exemplo n.º 25
0
//---------------------------------------------------------------------------
void TSessionLog::DoAddStartupInfo(TSessionData * Data)
{
  TGuard Guard(FCriticalSection);

  BeginUpdate();
  auto cleanup = finally([&]()
  {
    DeleteUnnecessary();
    EndUpdate();
  });
  {
    #define ADF(S, ...) DoAdd(llMessage, FORMAT(S, ##__VA_ARGS__), MAKE_CALLBACK(TSessionLog::DoAddToSelf, this));
    if (Data == nullptr)
    {
      AddSeparator();
      ADF(L"NetBox %s (OS %s)", FConfiguration->GetVersionStr().c_str(), FConfiguration->GetOSVersionStr().c_str());
      std::auto_ptr<THierarchicalStorage> Storage(FConfiguration->CreateStorage(false));
      assert(Storage.get());
      ADF(L"Configuration: %s", Storage->GetSource().c_str());

      if (0)
      {
        typedef BOOL (WINAPI * TGetUserNameEx)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize);
        HINSTANCE Secur32 = LoadLibrary(L"secur32.dll");
        TGetUserNameEx GetUserNameEx =
          (Secur32 != nullptr) ? reinterpret_cast<TGetUserNameEx>(GetProcAddress(Secur32, "GetUserNameExW")) : nullptr;
        wchar_t UserName[UNLEN + 1];
        unsigned long UserNameSize = LENOF(UserName);
        if ((GetUserNameEx == nullptr) || !GetUserNameEx(NameSamCompatible, (LPWSTR)UserName, &UserNameSize))
        {
          wcscpy(UserName, L"<Failed to retrieve username>");
        }
        ADF(L"Local account: %s", UserName);
      }
      unsigned short Y, M, D, H, N, S, MS;
      TDateTime DateTime = Now();
      DateTime.DecodeDate(Y, M, D);
      DateTime.DecodeTime(H, N, S, MS);
      UnicodeString dt = FORMAT(L"%02d.%02d.%04d %02d:%02d:%02d", D, M, Y, H, N, S);
      // ADF(L"Login time: %s", FormatDateTime(L"dddddd tt", Now()).c_str());
      ADF(L"Working directory: %s", GetCurrentDir().c_str());
      // ADF(L"Command-line: %s", CmdLine.c_str());
      // ADF(L"Time zone: %s", GetTimeZoneLogString().c_str());
      ADF(L"Login time: %s", dt.c_str());
      AddSeparator();
    }
    else
    {
      if (0)
      {
        ADF(L"Session name: %s (%s)", Data->GetSessionName().c_str(), Data->GetSource().c_str());
      }
      ADF(L"Host name: %s (Port: %d)", Data->GetHostNameExpanded().c_str(), Data->GetPortNumber());
      if (0)
      {
        ADF(L"User name: %s (Password: %s, Key file: %s)",
          Data->GetUserNameExpanded().c_str(), BooleanToEngStr(!Data->GetPassword().IsEmpty()).c_str(),
           BooleanToEngStr(!Data->GetPublicKeyFile().IsEmpty()).c_str())
      }
      ADF(L"Tunnel: %s", BooleanToEngStr(Data->GetTunnel()).c_str());
      if (Data->GetTunnel())
      {
        ADF(L"Tunnel: Host name: %s (Port: %d)", Data->GetTunnelHostName().c_str(), Data->GetTunnelPortNumber());
        if (0)
        {
          ADF(L"Tunnel: User name: %s (Password: %s, Key file: %s)",
            Data->GetTunnelUserName().c_str(), BooleanToEngStr(!Data->GetTunnelPassword().IsEmpty()).c_str(),
             BooleanToEngStr(!Data->GetTunnelPublicKeyFile().IsEmpty()).c_str());
            ADF(L"Tunnel: Local port number: %d", Data->GetTunnelLocalPortNumber());
        }
      }
      ADF(L"Transfer Protocol: %s", Data->GetFSProtocolStr().c_str());
      ADF(L"Code Page: %d", Data->GetCodePageAsNumber());
      wchar_t * PingTypes = L"-NC";
      TPingType PingType;
      intptr_t PingInterval;
      if (Data->GetFSProtocol() == fsFTP)
      {
        PingType = Data->GetFtpPingType();
        PingInterval = Data->GetFtpPingInterval();
      }
      else
      {
        PingType = Data->GetPingType();
        PingInterval = Data->GetPingInterval();
      }
      ADF(L"Ping type: %s, Ping interval: %d sec; Timeout: %d sec",
        UnicodeString(PingTypes[PingType]).c_str(), PingInterval, Data->GetTimeout());
      ADF(L"Proxy: %s%s", ProxyMethodList[Data->GetProxyMethod()],
        Data->GetProxyMethod() == pmSystem ?
          ::Format(L" (%s)", ProxyMethodList[Data->GetActualProxyMethod()]).c_str() :
          L"")
      if (Data->GetProxyMethod() != ::pmNone)
      {
        ADF(L"HostName: %s (Port: %d); Username: %s; Passwd: %s",
          Data->GetProxyHost().c_str(), Data->GetProxyPort(),
           Data->GetProxyUsername().c_str(), BooleanToEngStr(!Data->GetProxyPassword().IsEmpty()).c_str());
        if (Data->GetProxyMethod() == pmTelnet)
        {
          ADF(L"Telnet command: %s", Data->GetProxyTelnetCommand().c_str());
        }
        if (Data->GetProxyMethod() == pmCmd)
        {
          ADF(L"Local command: %s", Data->GetProxyLocalCommand().c_str());
        }
      }
      wchar_t const * BugFlags = L"+-A";
      if (Data->GetUsesSsh())
      {
        ADF(L"SSH protocol version: %s; Compression: %s",
          Data->GetSshProtStr().c_str(), BooleanToEngStr(Data->GetCompression()).c_str());
        ADF(L"Bypass authentication: %s",
         BooleanToEngStr(Data->GetSshNoUserAuth()).c_str());
        ADF(L"Try agent: %s; Agent forwarding: %s; TIS/CryptoCard: %s; KI: %s; GSSAPI: %s",
           BooleanToEngStr(Data->GetTryAgent()).c_str(), BooleanToEngStr(Data->GetAgentFwd()).c_str(), BooleanToEngStr(Data->GetAuthTIS()).c_str(),
           BooleanToEngStr(Data->GetAuthKI()).c_str(), BooleanToEngStr(Data->GetAuthGSSAPI()).c_str());
        if (Data->GetAuthGSSAPI())
        {
          ADF(L"GSSAPI: Forwarding: %s; Server realm: %s",
            BooleanToEngStr(Data->GetGSSAPIFwdTGT()).c_str(), Data->GetGSSAPIServerRealm().c_str());
        }
        ADF(L"Ciphers: %s; Ssh2DES: %s",
          Data->GetCipherList().c_str(), BooleanToEngStr(Data->GetSsh2DES()).c_str());
        UnicodeString Bugs;
        for (intptr_t Index = 0; Index < BUG_COUNT; ++Index)
        {
          Bugs += UnicodeString(BugFlags[Data->GetBug(static_cast<TSshBug>(Index))])+(Index<BUG_COUNT-1?L",":L"");
        }
        ADF(L"SSH Bugs: %s", Bugs.c_str());
        ADF(L"Return code variable: %s; Lookup user groups: %c",
           Data->GetDetectReturnVar() ? UnicodeString(L"Autodetect").c_str() : Data->GetReturnVar().c_str(),
           BugFlags[Data->GetLookupUserGroups()]);
        ADF(L"Shell: %s", Data->GetShell().IsEmpty() ? UnicodeString(L"default").c_str() : Data->GetShell().c_str());
        ADF(L"EOL: %d, UTF: %d", Data->GetEOLType(), Data->GetNotUtf());
        ADF(L"Clear aliases: %s, Unset nat.vars: %s, Resolve symlinks: %s",
           BooleanToEngStr(Data->GetClearAliases()).c_str(), BooleanToEngStr(Data->GetUnsetNationalVars()).c_str(),
           BooleanToEngStr(Data->GetResolveSymlinks()).c_str());
        ADF(L"LS: %s, Ign LS warn: %s, Scp1 Comp: %s",
           Data->GetListingCommand().c_str(),
           BooleanToEngStr(Data->GetIgnoreLsWarnings()).c_str(),
           BooleanToEngStr(Data->GetScp1Compatibility()).c_str());
      }
      if (Data->GetFSProtocol() == fsSFTP)
      {
        UnicodeString Bugs;
        for (int Index = 0; Index < SFTP_BUG_COUNT; Index++)
        {
          Bugs += UnicodeString(BugFlags[Data->GetSFTPBug(static_cast<TSftpBug>(Index))])+(Index<SFTP_BUG_COUNT-1 ? L"," : L"");
        }
        ADF(L"SFTP Bugs: %s", Bugs.c_str());
        ADF(L"SFTP Server: %s", Data->GetSftpServer().IsEmpty()? UnicodeString(L"default").c_str() : Data->GetSftpServer().c_str());
      }
      if (Data->GetFSProtocol() == fsFTP)
      {
        UnicodeString Ftps;
        switch (Data->GetFtps())
        {
          case ftpsImplicit:
            Ftps = L"Implicit TLS/SSL";
            break;

          case ftpsExplicitSsl:
            Ftps = L"Explicit SSL";
            break;

          case ftpsExplicitTls:
            Ftps = L"Explicit TLS";
            break;

          default:
            assert(Data->GetFtps() == ftpsNone);
            Ftps = L"None";
            break;
        }
        ADF(L"FTP: FTPS: %s; Passive: %s [Force IP: %c]; MLSD: %c  [List all: %c]",
           Ftps.c_str(), BooleanToEngStr(Data->GetFtpPasvMode()).c_str(),
           BugFlags[Data->GetFtpForcePasvIp()],
           BugFlags[Data->GetFtpUseMlsd()],
           BugFlags[Data->GetFtpListAll()]);
        if (Data->GetFtps() != ftpsNone)
        {
          ADF(L"Session reuse: %s", BooleanToEngStr(Data->GetSslSessionReuse()).c_str());
          ADF(L"TLS/SSL versions: %s-%s", GetTlsVersionName(Data->GetMinTlsVersion()).c_str(), GetTlsVersionName(Data->GetMaxTlsVersion()).c_str());
        }
      }
      ADF(L"Local directory: %s, Remote directory: %s, Update: %s, Cache: %s",
        (Data->GetLocalDirectory().IsEmpty() ? UnicodeString(L"default").c_str() : Data->GetLocalDirectory().c_str()),
         (Data->GetRemoteDirectory().IsEmpty() ? UnicodeString(L"home").c_str() : Data->GetRemoteDirectory().c_str()),
         BooleanToEngStr(Data->GetUpdateDirectories()).c_str(),
         BooleanToEngStr(Data->GetCacheDirectories()).c_str());
      ADF(L"Cache directory changes: %s, Permanent: %s",
         BooleanToEngStr(Data->GetCacheDirectoryChanges()).c_str(),
         BooleanToEngStr(Data->GetPreserveDirectoryChanges()).c_str());
      intptr_t TimeDifferenceMin = TimeToMinutes(Data->GetTimeDifference());
      ADF(L"DST mode: %d; Timezone offset: %dh %dm", static_cast<int>(Data->GetDSTMode()), (TimeDifferenceMin / MinsPerHour), (TimeDifferenceMin % MinsPerHour));

      if (Data->GetFSProtocol() == fsWebDAV)
      {
        ADF(L"Compression: %s",
          BooleanToEngStr(Data->GetCompression()).c_str());
      }

      AddSeparator();
    }

    #undef ADF
  }
}
Exemplo n.º 26
0
// Обработка добавления/удаления в/из список выбранных таблиц символов
void ProcessSelected(bool select)
{
	if (Opt.CPMenuMode && select)
		return;

	UINT itemPosition = CodePages->GetSelectPos();
	UINT codePage = GetMenuItemCodePage();

	if ((select && IsPositionFavorite(itemPosition)) || (!select && IsPositionNormal(itemPosition)))
	{
		// Преобразуем номер таблицы символов в строку
		FormatString strCPName;
		strCPName<<codePage;
		// Получаем текущее состояние флага в реестре
		int selectType = 0;
		GetRegKey(FavoriteCodePagesKey, strCPName, selectType, 0);

		// Удаляем/добавляем в ресестре информацию о выбранной кодовой странице
		if (select)
			SetRegKey(FavoriteCodePagesKey, strCPName, CPST_FAVORITE | (selectType & CPST_FIND ? CPST_FIND : 0));
		else if (selectType & CPST_FIND)
			SetRegKey(FavoriteCodePagesKey, strCPName, CPST_FIND);
		else
			DeleteRegValue(FavoriteCodePagesKey, strCPName);

		// Создаём новый элемент меню
		MenuItemEx newItem;
		newItem.Clear();
		newItem.strName = CodePages->GetItemPtr()->strName;
		newItem.UserData = (char *)(UINT_PTR)codePage;
		newItem.UserDataSize = sizeof(UINT);
		// Сохраняем позицию курсора
		int position=CodePages->GetSelectPos();
		// Удаляем старый пункт меню
		CodePages->DeleteItem(CodePages->GetSelectPos());

		// Добавляем пункт меню в новое место
		if (select)
		{
			// Добавляем разделитель, если выбранных кодовых страниц ещё не было
			// и после добавления останутся нормальные кодовые страницы
			if (!favoriteCodePages && normalCodePages>1)
				AddSeparator(MSG(MGetCodePageFavorites),CodePages->GetItemCount()-normalCodePages);

			// Ищем позицию, куда добавить элемент
			int newPosition = GetCodePageInsertPosition(
			                      codePage,
			                      CodePages->GetItemCount()-normalCodePages-favoriteCodePages,
			                      favoriteCodePages
			                  );
			// Добавляем кодовою страницу в выбранные
			CodePages->AddItem(&newItem, newPosition);

			// Удаляем разделитель, если нет обыкновынных кодовых страниц
			if (normalCodePages==1)
				CodePages->DeleteItem(CodePages->GetItemCount()-1);

			// Изменяем счётчики нормальных и выбранных кодовых страниц
			favoriteCodePages++;
			normalCodePages--;
			position++;
		}
		else
		{
			// Удаляем разделитеь, если после удаления не останнется ни одной
			// выбранной таблицы символов
			if (favoriteCodePages==1 && normalCodePages>0)
				CodePages->DeleteItem(CodePages->GetItemCount()-normalCodePages-2);

			// Переносим элемент в нормальные таблицы, только если они показываются
			if (!Opt.CPMenuMode)
			{
				// Добавляем разделитель, если не было ни одной нормальной кодовой страницы
				if (!normalCodePages)
					AddSeparator(MSG(MGetCodePageOther));

				// Добавляем кодовою страницу в нормальные
				CodePages->AddItem(
				    &newItem,
				    GetCodePageInsertPosition(
				        codePage,
				        CodePages->GetItemCount()-normalCodePages,
				        normalCodePages
				    )
				);
				normalCodePages++;
			}
			// Если в режиме скрытия нормальных таблиц мы удалили последнюю выбранную таблицу, то удаляем и разделитель
			else if (favoriteCodePages==1)
				CodePages->DeleteItem(CodePages->GetItemCount()-normalCodePages-1);

			favoriteCodePages--;

			if (position==CodePages->GetItemCount()-normalCodePages-1)
				position--;
		}

		// Устанавливаем позицию в меню
		CodePages->SetSelectPos(position>=CodePages->GetItemCount() ? CodePages->GetItemCount()-1 : position, 1);

		// Показываем меню
		if (Opt.CPMenuMode)
			CodePages->SetPosition(-1, -1, 0, 0);

		CodePages->Show();
	}
}
Exemplo n.º 27
0
void EditToolBar::Populate()
{
   SetBackgroundColour( theTheme.Colour( clrMedium  ) );
   MakeButtonBackgroundsSmall();

   /* Buttons */
   // Tooltips slightly more verbose than the menu entries are.
   AddButton(this, bmpCut, bmpCut, bmpCutDisabled, ETBCutID,
      _("Cut selection"));
   AddButton(this, bmpCopy, bmpCopy, bmpCopyDisabled, ETBCopyID,
      _("Copy selection"));
   AddButton(this, bmpPaste, bmpPaste, bmpPasteDisabled, ETBPasteID,
      _("Paste"));
   AddButton(this, bmpTrim, bmpTrim, bmpTrimDisabled, ETBTrimID,
      _("Trim audio outside selection"));
   AddButton(this, bmpSilence, bmpSilence, bmpSilenceDisabled, ETBSilenceID,
      _("Silence audio selection"));

   AddSeparator();

   AddButton(this, bmpUndo, bmpUndo, bmpUndoDisabled, ETBUndoID,
      _("Undo"));
   AddButton(this, bmpRedo, bmpRedo, bmpRedoDisabled, ETBRedoID,
      _("Redo"));

   AddSeparator();

#ifdef OPTION_SYNC_LOCK_BUTTON
   AddButton(this, bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID,
               _("Sync-Lock Tracks"), true);

   AddSeparator();
#endif

   // Tooltips match menu entries.
   // We previously had longer tooltips which were not more clear.
   AddButton(this, bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID,
      _("Zoom In"));
   AddButton(this, bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID,
      _("Zoom Out"));
   AddButton(this, bmpZoomSel, bmpZoomSel, bmpZoomSelDisabled, ETBZoomSelID,
      _("Zoom to Selection"));
   AddButton(this, bmpZoomFit, bmpZoomFit, bmpZoomFitDisabled, ETBZoomFitID,
      _("Fit to Width"));

#ifdef EXPERIMENTAL_ZOOM_TOGGLE_BUTTON
   AddButton(this, bmpZoomToggle, bmpZoomToggle, bmpZoomToggleDisabled, ETBZoomToggleID,
      _("Zoom Toggle"));
#endif



   mButtons[ETBZoomInID]->SetEnabled(false);
   mButtons[ETBZoomOutID]->SetEnabled(false);
#ifdef EXPERIMENTAL_ZOOM_TOGGLE_BUTTON
   mButtons[ETBZoomToggleID]->SetEnabled(false);
#endif

   mButtons[ETBZoomSelID]->SetEnabled(false);
   mButtons[ETBZoomFitID]->SetEnabled(false);
   mButtons[ETBPasteID]->SetEnabled(false);

#ifdef OPTION_SYNC_LOCK_BUTTON
   mButtons[ETBSyncLockID]->PushDown();
#endif

#if defined(EXPERIMENTAL_EFFECTS_RACK)
   AddSeparator();
   AddButton(this, bmpEditEffects, bmpEditEffects, bmpEditEffects, ETBEffectsID,
      _("Show Effects Rack"), true);
#endif

   RegenerateTooltips();
}
Exemplo n.º 28
0
int CTaskPane::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CMFCTasksPane::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	SetIconsList (IDB_TASKS, 16);
	
	SetCaption (_T("Tasks Pane"));
	SetPageCaption (0, _T("New document"));

	m_nDocumentsGroup = AddGroup (_T("Open a document"), FALSE, TRUE);

	// Add MRU list
	AddMRUFilesList (m_nDocumentsGroup);
	AddTask (m_nDocumentsGroup, _T("More Documents..."), 0, ID_FILE_OPEN);

	int nPage1Gr2 = AddGroup (_T("New"));

	AddTask (nPage1Gr2, _T("Blank Document"), 1, ID_FILE_NEW);

	AddTask (nPage1Gr2, _T("Blank Web Page"), 2, ID_DUMMY);
	AddSeparator (nPage1Gr2);
	AddTask (nPage1Gr2, _T("Blank E-mail message"), 3, ID_DUMMY);

	int nPage1Gr3 = AddGroup (_T("New from existing document"));

	AddTask (nPage1Gr3, _T("Choose document..."), 4, ID_DUMMY);

	int nPage1Gr4 = AddGroup (_T("New from template"));

	AddTask (nPage1Gr4, _T("General Templates..."), 5, ID_DUMMY);
	AddTask (nPage1Gr4, _T("Templates on my Web Sites..."), 6, ID_DUMMY);
	AddTask (nPage1Gr4, _T("Templates on Microsoft.com..."), 7, ID_DUMMY);

	int nPage1Gr5 = AddGroup (_T(""), TRUE /* Group at bottom */);

	AddTask (nPage1Gr5, _T("Add Network Place..."), 8, ID_DUMMY);
	AddTask (nPage1Gr5, _T("Help..."), 9, ID_DUMMY);
	AddLabel (nPage1Gr5, _T("Label"));

	//--------
	// Page 2:
	//--------
	int nPage2 = AddPage (_T("Basic Search"));

	int nPage2Gr1 = AddGroup (nPage2, _T("Search for:"));

	AddTask (nPage2Gr1, _T("Search Tips..."), 9, ID_DUMMY);

	int nPage2Gr3 = AddGroup (nPage2, _T("See also:"));

	AddTask (nPage2Gr3, _T("Advanced Search"), 9, ID_DUMMY);
	AddTask (nPage2Gr3, _T("Find in this document..."), 9, ID_DUMMY);

	//--------
	// Page 3:
	//--------
	int nPage3 = AddPage (_T("Custom page"));

	int nPage3Gr1 = AddGroup (nPage3, _T("Folders"));

	if (!CreateTreeWindow())
	{
		TRACE0("Failed to create the custom window\n");
		return -1;      // fail to create
	}

	AddWindow (nPage3Gr1, m_wndTree.GetSafeHwnd (), 65);
	AddTask (nPage3Gr1, _T("My favorites..."), 0, ID_DUMMY);

	int nPage3Gr2 = AddGroup (nPage3, _T("Enter your text"));

	CRect rectDummy;
	rectDummy.SetRectEmpty ();
	DWORD dwEditStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | 
		ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN;
	m_Font.CreateStockObject (DEFAULT_GUI_FONT);
	if (!m_wndEdit.Create (dwEditStyle, rectDummy, this, (UINT)-1))
	{
		TRACE0("Failed to create the edit window\n");
		return -1;      // fail to create
	}
	m_wndEdit.SetFont (&m_Font);
	m_wndEdit.SetWindowText(
		_T("This is the standard multiline Edit Box.\r\nHere you can type your text."));
	
	AddWindow (nPage3Gr2, m_wndEdit.GetSafeHwnd (), 65);
	return 0;
}