Thema: Delphi Automatisierung

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#7

AW: Automatisierung

  Alt 5. Sep 2017, 15:10
Habe es jetzt erst mal noch etwas angepasst damit es sich mehr an das normale Menu orientiert.

Delphi-Quellcode:
procedure AppendMenu(WinHandle: HWND);
var
  Enabled: BOOL;
  Color: COLORREF;
begin

  // Aktiven Status prüfen und Farbe zuweisen
  Enabled := (KVideo_GetPlayerState <> psNotReady);
  if Enabled then
     Color := SKAERO_POPMENUHILITE
  else
  Color := $FF737373;

   if gPMenu.hPopUpHandle <> 0 then
  begin
    // About
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_About.ico';
    PopUpMenu.ItemToolTip := 'Oops...' + CHR(13) + 'Are they in the wrong place?';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 2;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_About, 'About');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 22;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR, '-Appearance-');

    // Skins
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SkinFolder.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 42;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_SKIN, 'Skins');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 62;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR1, '-VideoFilter-');

    // Filter
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 82;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_FILTER, 'Filter');

    // LAV Filter Configuration
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Filter.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 102;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_LAVFILTERCONFIG, 'LAV Filter Configuration');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 122;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR2, '-File Dependencies-');

    // Add File
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_File.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 142;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_ADDFILE, 'Add File');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 162;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR3, '-Options-');

    // Settings
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Option.ico';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 182;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_OPTION, 'Settings');

    // SubTitle Config
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitlecfg.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 202;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_SUBTITLECONFIG, 'SubTitle Config');

    // Show MediaFile Property
    if (KVideo_MediaInfoServiceReady) then
    begin
      if not(KVideo_GetMediaProperty(aMediaProperty)) then
      begin
        Enabled := false;
        Color := $FF737373;
      end else
      begin
        Enabled := True;
        Color := SKAERO_POPMENUHILITE;
      end;
    end else
    begin
      Enabled := false;
      Color := $FF737373;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Info.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 222;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_MEDIAFILEPROPERTYS, 'Show MediaFile Property');

    // Select Video Track
    if (aMediaProperty.NumVideoStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Video.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 242;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_VIDEOSTREAM, 'Select Video Track');

    // Select Audio Track
    if (aMediaProperty.NumAudioStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Audio.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 262;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_AUDIOSTREAM, 'Select Audio Track');

    // Select SubTitle Track
    if (aMediaProperty.NumSubTitleStream = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_SubTitle.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 282;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_SUBTITLETRACK, 'Select SubTitle Track');

    // Chapter
    if (aMediaProperty.NumChapter = 0) then
    begin
      Enabled := false;
      Color := $FF737373;
    end else
    begin
      Enabled := True;
      Color := SKAERO_POPMENUHILITE;
    end;
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Chapter.ico';
    PopUpMenu.ItemHiliteColor := Color;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemEnabled := Enabled;
    PopUpMenu.ItemTop := 302;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_POPUP, IDM_CHAPTER, 'Chapter');

    // Seperator
    PopUpMenu.ItemHiliteColor := SKAERO_ACTIVECAPTION;
    PopUpMenu.ItemTextAlligment := Center;
    PopUpMenu.ItemEnabled := False;
    PopUpMenu.ItemTop := 322;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW or MF_SEPARATOR, IDM_SEPERATOR4, '-Application-');

    // Close
    PopUpMenu.ItemIconPath := SKAERO_CONFIG_GetSkinFolder + 'Menu\MEN_Close.ico';
    PopUpMenu.ItemToolTip := 'Bye, Bye';
    PopUpMenu.ItemHiliteColor := SKAERO_POPMENUHILITE;
    PopUpMenu.ItemTextAlligment := Left;
    PopUpMenu.ItemTop := 342;
    PopUpMenu.AppendMenu(PopUpMenu.Handle, MF_OWNERDRAW, IDM_CLOSE, 'Close');
  end;

end;
gruss