Split event flag/work groups to tabs

Closes #4719

More groups can be added to the enum, and re-defined via their type-char column.
Updating translations will automatically add those types to the list of translatables.

Fixes the Dark Mode bug where the first tab of the Event flag/work editor (LGPE) didn't respect dark mode; now that all all event editors are sub-tabbed, we use the workaround present in all (on shown flip back to the first tab).
This commit is contained in:
Kurt 2026-03-01 00:00:34 -06:00
parent b93d57cc9a
commit 20a92f533b
22 changed files with 888 additions and 563 deletions

View File

@ -14,9 +14,6 @@ public sealed class AdvancedSettings
[LocalizedDescription("Folder path that contains dump(s) of block hash-names. If a specific dump file does not exist, only names defined within the program's code will be loaded.")]
public string PathBlockKeyList { get; set; } = string.Empty;
[LocalizedDescription("Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.")]
public NamedEventType HideEventTypeBelow { get; set; }
[LocalizedDescription("Hide event variable names for that contain any of the comma-separated substrings below. Removes event values from the GUI that the user doesn't care to view.")]
public string HideEvent8Contains { get; set; } = string.Empty;

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Fortfahren
ErrorWindow.B_CopyToClipboard=In Zwischenablage kopieren
ErrorWindow.L_Message=An unknown error has occurred.
ErrorWindow.L_ProvideInfo=Bitte gib diese Informationen an, wenn du den Fehler meldest:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Schweregrad der Legalitäts Analyse wen
LocalizedDescription.HiddenPowerOnChangeMaxPower=Wenn der Kraftreserve Typ geändert wird, ändere die DVs auf den höchst möglichen Wert, um die best mögliche Stärke zu erhalten. Sonst werden die originalen DVs nur leicht abgeändert.
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Verstecke Event Variablen Namen, welche die unten stehenden, durch Komma getrennten, Zeichenfolgen enthalten. Entfernt Event Variablen aus der Benutzeroberfläche, die den Benutzer nicht interessieren.
LocalizedDescription.HideEventTypeBelow=Verstecke Event Variablen unter diesem Event Typ Wert. Entfernt Event Variablen aus der Benutzeroberfläche, die den Benutzer nicht interessieren.
LocalizedDescription.HideSAVDetails=Verstecke Spielstand Details in Programmtitel
LocalizedDescription.HideSecretDetails=Verstecke persönliche Details im Editor
LocalizedDescription.HOMETransferTrackerNotPresent=Kennzeichnet in der Legalitäts Analyse, wenn der HOME Tracker fehlt.
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Give All
MoveShopEditor.B_Cancel=Cancel
MoveShopEditor.B_None=Remove All
MoveShopEditor.B_Save=Save
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Continue
ErrorWindow.B_CopyToClipboard=Copy to Clipboard
ErrorWindow.L_Message=An unknown error has occurred.
ErrorWindow.L_ProvideInfo=Please provide this information when reporting this error:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Severity to flag a Legality Check if a
LocalizedDescription.HiddenPowerOnChangeMaxPower=When changing the Hidden Power type, automatically maximize the IVs to ensure the highest Base Power result. Otherwise, keep the IVs as close as possible to the original.
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Hide event variable names for that contain any of the comma-separated substrings below. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideEventTypeBelow=Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideSAVDetails=Hide Save File Details in Program Title
LocalizedDescription.HideSecretDetails=Hide Secret Details in Editors
LocalizedDescription.HOMETransferTrackerNotPresent=Severity to flag a Legality Check if the HOME Tracker is Missing
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Give All
MoveShopEditor.B_Cancel=Cancel
MoveShopEditor.B_None=Remove All
MoveShopEditor.B_Save=Save
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Continuar
ErrorWindow.B_CopyToClipboard=Copiar al portapapeles
ErrorWindow.L_Message=Ha ocurrido un error desconocido.
ErrorWindow.L_ProvideInfo=Por favor, proporcione esta información cuando reporte el fallo:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Negro
FestivalPlazaFacilityColor.Blue=Azul
FestivalPlazaFacilityColor.Brown=Marrón
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=En la validación de Legalidad, marcar
LocalizedDescription.HiddenPowerOnChangeMaxPower=Cuando se cambia el tipo de Poder Oculto, automáticamente maximixar los IVs para resultar con el mayor Poder Base. De otra forma mantener lo más cerca posible al original.
LocalizedDescription.HiddenProperties=Propiedades a esconder en la cuadrícula.
LocalizedDescription.HideEvent8Contains=Ocultar eventos que contengan alguna de las palabras (separadas por comas) siguientes en el nombre. Elimina de la interfaz los valores de los eventos que no le interesa version al usuario.
LocalizedDescription.HideEventTypeBelow=Ocultar variables de evento por debajo de este valor de tipo de evento. Elimina de la interfaz los valores de los eventos que no le interesa version al usuario.
LocalizedDescription.HideSAVDetails=Ocultar detalles de partidas guardadas en el título del programa
LocalizedDescription.HideSecretDetails=Ocultar detalles secretos en los editores
LocalizedDescription.HOMETransferTrackerNotPresent=En la validación de Legalidad, marcar Severidad para detectar una validación de legalidad si falta el rastreador HOME
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Dar todos
MoveShopEditor.B_Cancel=Cancelar
MoveShopEditor.B_None=Ninguno
MoveShopEditor.B_Save=Guardar
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Precisión
OPower6BattleType.Attack=Ataque
OPower6BattleType.Critical=Crítico

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Continuar
ErrorWindow.B_CopyToClipboard=Copiar al portapapeles
ErrorWindow.L_Message=Ha ocurrido un error desconocido.
ErrorWindow.L_ProvideInfo=Por favor, proporcione esta información cuando reporte el fallo:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Negro
FestivalPlazaFacilityColor.Blue=Azul
FestivalPlazaFacilityColor.Brown=Marrón
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=En la validación de Legalidad, marcar
LocalizedDescription.HiddenPowerOnChangeMaxPower=Cuando se cambia el tipo de Poder Oculto, automáticamente maximixar los IVs para resultar con el mayor Poder Base. De otra forma mantener lo más cerca posible al original.
LocalizedDescription.HiddenProperties=Propiedades a esconder en la cuadrícula.
LocalizedDescription.HideEvent8Contains=Ocultar eventos que contengan alguna de las palabras (separadas por comas) siguientes en el nombre. Elimina de la interfaz los valores de los eventos que no le interesa version al usuario.
LocalizedDescription.HideEventTypeBelow=Ocultar variables de evento por debajo de este valor de tipo de evento. Elimina de la interfaz los valores de los eventos que no le interesa version al usuario.
LocalizedDescription.HideSAVDetails=Ocultar detalles de partidas guardadas en el título del programa
LocalizedDescription.HideSecretDetails=Ocultar detalles secretos en los editores
LocalizedDescription.HOMETransferTrackerNotPresent=En la validación de Legalidad, marcar Severidad para detectar una validación de legalidad si falta el rastreador HOME
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Dar todos
MoveShopEditor.B_Cancel=Cancelar
MoveShopEditor.B_None=Ninguno
MoveShopEditor.B_Save=Guardar
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Precisión
OPower6BattleType.Attack=Ataque
OPower6BattleType.Critical=Crítico

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Continuer
ErrorWindow.B_CopyToClipboard=Copier dans le presse-papiers
ErrorWindow.L_Message=Une erreur inconnue s'est produite.
ErrorWindow.L_ProvideInfo=Veuillez fournir les informations suivantes dans votre rapport d'erreur :
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Noir
FestivalPlazaFacilityColor.Blue=Bleu
FestivalPlazaFacilityColor.Brown=Marron
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Severity to flag a Legality Check if a
LocalizedDescription.HiddenPowerOnChangeMaxPower=When changing the Hidden Power type, automatically maximize the IVs to ensure the highest Base Power result. Otherwise, keep the IVs as close as possible to the original.
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Hide event variable names for that contain any of the comma-separated substrings below. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideEventTypeBelow=Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideSAVDetails=Cacher les détails de la sauvegarde
LocalizedDescription.HideSecretDetails=Cacher les détails secrets dans les éditeurs
LocalizedDescription.HOMETransferTrackerNotPresent=Severity to flag a Legality Check if the HOME Tracker is Missing
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Donner tout
MoveShopEditor.B_Cancel=Annuler
MoveShopEditor.B_None=Retirer tout
MoveShopEditor.B_Save=Sauvegarder
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Précision
OPower6BattleType.Attack=Attaque
OPower6BattleType.Critical=Critique

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=Continua
ErrorWindow.B_CopyToClipboard=Copiato negli appunti
ErrorWindow.L_Message=An unknown error has occurred.
ErrorWindow.L_ProvideInfo=Per favore includi queste informazioni quando riporti questo errore:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Forza una segnalazione di Legalità se
LocalizedDescription.HiddenPowerOnChangeMaxPower=Massimizza automaticamente gli IV quando si cambia il tipo di Introforza per assicurare il massimo punteggio di Potenza Base. Altrimenti, mantieni gli IV il più vicino possibile agli originali.
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Nascondi i nomi delle variabili evento che contengono una qualsiasi delle sottostringhe separate da virgole di seguito riportate. Rimuove i valori evento dall'Interfaccia di non interesse dell'utente.
LocalizedDescription.HideEventTypeBelow=Nascondi variabili evento al di sotto del valore di questa tipologia di eventi. Rimuove i valori evento dall'Interfaccia di non interesse dell'utente.
LocalizedDescription.HideSAVDetails=Nascondi i dettagli del File di Salvataggio dal Titolo del Programma.
LocalizedDescription.HideSecretDetails=Nascondi i Dettagli Segreti dagli Editor.
LocalizedDescription.HOMETransferTrackerNotPresent=Forza una segnalazione di legalità se il codice di Tracciamento di Pokémon Home è assente.
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Dai Tutto
MoveShopEditor.B_Cancel=Annulla
MoveShopEditor.B_None=Rimuovi Tutto
MoveShopEditor.B_Save=Salva
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=続ける
ErrorWindow.B_CopyToClipboard=クリップボードにコピー
ErrorWindow.L_Message=An unknown error has occurred.
ErrorWindow.L_ProvideInfo=このエラーを報告する時は、こちらの情報を提供してください:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Severity to flag a Legality Check if a
LocalizedDescription.HiddenPowerOnChangeMaxPower=めざパのタイプを変更した場合、自動的に個体値が最大化され、理想個体になります。それ以外の場合、個体値をなるべく正規にしてください。
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Hide event variable names for that contain any of the comma-separated substrings below. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideEventTypeBelow=Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideSAVDetails=プログラム名の部分のセーブファイル情報を隠す。
LocalizedDescription.HideSecretDetails=マスクデータの一部(性格値等)を隠す。
LocalizedDescription.HOMETransferTrackerNotPresent=Severity to flag a Legality Check if the HOME Tracker is Missing
@ -676,6 +680,18 @@ MoveShopEditor.B_All=全て取得
MoveShopEditor.B_Cancel=キャンセル
MoveShopEditor.B_None=全て消去
MoveShopEditor.B_Save=保存
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=계속
ErrorWindow.B_CopyToClipboard=클립보드에 복사
ErrorWindow.L_Message=An unknown error has occurred.
ErrorWindow.L_ProvideInfo=오류를 보고할 때 이 정보를 제공해 주세요:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=Severity to flag a Legality Check if a
LocalizedDescription.HiddenPowerOnChangeMaxPower=When changing the Hidden Power type, automatically maximize the IVs to ensure the highest Base Power result. Otherwise, keep the IVs as close as possible to the original.
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=Hide event variable names for that contain any of the comma-separated substrings below. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideEventTypeBelow=Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.
LocalizedDescription.HideSAVDetails=프로그램 제목에서 세이브 파일 상세 정보 숨기기
LocalizedDescription.HideSecretDetails=편집 시 비밀 정보 숨기기
LocalizedDescription.HOMETransferTrackerNotPresent=Severity to flag a Legality Check if the HOME Tracker is Missing
@ -676,6 +680,18 @@ MoveShopEditor.B_All=Give All
MoveShopEditor.B_Cancel=Cancel
MoveShopEditor.B_None=Remove All
MoveShopEditor.B_Save=Save
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=继续
ErrorWindow.B_CopyToClipboard=复制到剪切板
ErrorWindow.L_Message=发生未知错误
ErrorWindow.L_ProvideInfo=提交错误报告时请提供以下信息:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=黑
FestivalPlazaFacilityColor.Blue=蓝
FestivalPlazaFacilityColor.Brown=棕
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=如果第八世代当前持有人回忆
LocalizedDescription.HiddenPowerOnChangeMaxPower=当修改觉醒力量属性时,程序将自动尽最大可能使用最高的个体值来确保基础能力,否则使用最接近原始数值的个体值。
LocalizedDescription.HiddenProperties=报告网格中要隐藏的属性。
LocalizedDescription.HideEvent8Contains=隐藏不需要展示的活动名称,输入格式以逗号分隔。
LocalizedDescription.HideEventTypeBelow=隐藏不要展示的活动类型。
LocalizedDescription.HideSAVDetails=隐藏程序标题中的保存文件详细信息。
LocalizedDescription.HideSecretDetails=在编辑器中隐藏秘密细节。
LocalizedDescription.HOMETransferTrackerNotPresent=如果HOME追踪丢失则标记合法性检查的严重性。
@ -676,6 +680,18 @@ MoveShopEditor.B_All=获得全部
MoveShopEditor.B_Cancel=取消
MoveShopEditor.B_None=全部清除
MoveShopEditor.B_Save=保存
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=命中之力
OPower6BattleType.Attack=攻击之力
OPower6BattleType.Critical=要害之力

View File

@ -126,6 +126,11 @@ ErrorWindow.B_Continue=繼續
ErrorWindow.B_CopyToClipboard=複製到剪切板
ErrorWindow.L_Message=發生未知錯誤
ErrorWindow.L_ProvideInfo=提交錯誤報告時請提供以下資訊:
EventVarType.Event=Event
EventVarType.Scene=Scene
EventVarType.System=System
EventVarType.Vanish=Vanish
EventVarType.Zone=Zone
FestivalPlazaFacilityColor.Black=Black
FestivalPlazaFacilityColor.Blue=Blue
FestivalPlazaFacilityColor.Brown=Brown
@ -247,7 +252,6 @@ LocalizedDescription.Gen8MemoryMissingHT=對缺失第八世代現時持有人回
LocalizedDescription.HiddenPowerOnChangeMaxPower=當修改覺醒力量屬性時,自動最大化個體值以確保基礎能力。否則使個體值盡量與原個體值接近。
LocalizedDescription.HiddenProperties=Properties to hide from the report grid.
LocalizedDescription.HideEvent8Contains=隱藏包含逗號分隔子串之活動名稱並從GUI中移除不關心之活動名稱值。
LocalizedDescription.HideEventTypeBelow=隱藏該活動類型值下之各類事件並從GUI中移除用戶不關心的活動名稱值。
LocalizedDescription.HideSAVDetails=隱藏程式標題中的儲存資料檔詳細資訊
LocalizedDescription.HideSecretDetails=在編輯器中隱藏秘密細節
LocalizedDescription.HOMETransferTrackerNotPresent=HOME追蹤碼丟失合法性檢查等級。
@ -676,6 +680,18 @@ MoveShopEditor.B_All=獲得全部
MoveShopEditor.B_Cancel=取消
MoveShopEditor.B_None=全部清除
MoveShopEditor.B_Save=儲存
NamedEventType.Achievement=Achievement
NamedEventType.EventEncounter=EventEncounter
NamedEventType.FlyToggle=FlyToggle
NamedEventType.GiftAvailable=GiftAvailable
NamedEventType.HiddenItem=HiddenItem
NamedEventType.Misc=Misc
NamedEventType.None=None
NamedEventType.Rebattle=Rebattle
NamedEventType.Statistic=Statistic
NamedEventType.StoryProgress=StoryProgress
NamedEventType.TrainerToggle=TrainerToggle
NamedEventType.UsefulFeature=UsefulFeature
OPower6BattleType.Accuracy=Accuracy
OPower6BattleType.Attack=Attack
OPower6BattleType.Critical=Critical

View File

@ -20,10 +20,7 @@ public SAV_FestivalPlaza(SAV7 sav)
InitializeComponent();
if (Application.IsDarkModeEnabled)
{
foreach (TabPage tab in TC_Editor.TabPages)
tab.UseVisualStyleBackColor = false;
}
WinFormsTranslator.ReformatDark(TC_Editor);
SAV = (SAV7)(Origin = sav).Clone();
editing = true;

View File

@ -50,11 +50,11 @@ private void InitializeComponent()
L_EventFlagWarn = new System.Windows.Forms.Label();
TC_Features = new System.Windows.Forms.TabControl();
GB_Flags = new System.Windows.Forms.TabPage();
TLP_Flags = new System.Windows.Forms.TableLayoutPanel();
TC_Flags = new System.Windows.Forms.TabControl();
GB_System = new System.Windows.Forms.TabPage();
TLP_System = new System.Windows.Forms.TableLayoutPanel();
TC_System = new System.Windows.Forms.TabControl();
GB_Work = new System.Windows.Forms.TabPage();
TLP_Work = new System.Windows.Forms.TableLayoutPanel();
TC_Work = new System.Windows.Forms.TabControl();
GB_Research = new System.Windows.Forms.TabPage();
GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)NUD_WorkIndex).BeginInit();
@ -320,7 +320,7 @@ private void InitializeComponent()
//
// GB_Flags
//
GB_Flags.Controls.Add(TLP_Flags);
GB_Flags.Controls.Add(TC_Flags);
GB_Flags.Location = new System.Drawing.Point(4, 26);
GB_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Flags.Name = "GB_Flags";
@ -330,25 +330,20 @@ private void InitializeComponent()
GB_Flags.Text = "Event Flags";
GB_Flags.UseVisualStyleBackColor = true;
//
// TLP_Flags
// TC_Flags
//
TLP_Flags.AutoScroll = true;
TLP_Flags.ColumnCount = 2;
TLP_Flags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Flags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Flags.Dock = System.Windows.Forms.DockStyle.Fill;
TLP_Flags.Location = new System.Drawing.Point(4, 3);
TLP_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TLP_Flags.Name = "TLP_Flags";
TLP_Flags.RowCount = 2;
TLP_Flags.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Flags.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Flags.Size = new System.Drawing.Size(579, 321);
TLP_Flags.TabIndex = 1;
TC_Flags.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Flags.Location = new System.Drawing.Point(4, 3);
TC_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Flags.Multiline = true;
TC_Flags.Name = "TC_Flags";
TC_Flags.SelectedIndex = 0;
TC_Flags.Size = new System.Drawing.Size(579, 321);
TC_Flags.TabIndex = 1;
//
// GB_System
//
GB_System.Controls.Add(TLP_System);
GB_System.Controls.Add(TC_System);
GB_System.Location = new System.Drawing.Point(4, 26);
GB_System.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_System.Name = "GB_System";
@ -358,25 +353,20 @@ private void InitializeComponent()
GB_System.Text = "System Flags";
GB_System.UseVisualStyleBackColor = true;
//
// TLP_System
// TC_System
//
TLP_System.AutoScroll = true;
TLP_System.ColumnCount = 2;
TLP_System.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_System.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_System.Dock = System.Windows.Forms.DockStyle.Fill;
TLP_System.Location = new System.Drawing.Point(4, 3);
TLP_System.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TLP_System.Name = "TLP_System";
TLP_System.RowCount = 2;
TLP_System.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_System.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_System.Size = new System.Drawing.Size(579, 321);
TLP_System.TabIndex = 1;
TC_System.Dock = System.Windows.Forms.DockStyle.Fill;
TC_System.Location = new System.Drawing.Point(4, 3);
TC_System.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_System.Multiline = true;
TC_System.Name = "TC_System";
TC_System.SelectedIndex = 0;
TC_System.Size = new System.Drawing.Size(579, 321);
TC_System.TabIndex = 1;
//
// GB_Work
//
GB_Work.Controls.Add(TLP_Work);
GB_Work.Controls.Add(TC_Work);
GB_Work.Location = new System.Drawing.Point(4, 26);
GB_Work.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Work.Name = "GB_Work";
@ -386,22 +376,16 @@ private void InitializeComponent()
GB_Work.Text = "Work Values";
GB_Work.UseVisualStyleBackColor = true;
//
// TLP_Work
// TC_Work
//
TLP_Work.AutoScroll = true;
TLP_Work.ColumnCount = 3;
TLP_Work.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Work.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Work.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 579F));
TLP_Work.Dock = System.Windows.Forms.DockStyle.Fill;
TLP_Work.Location = new System.Drawing.Point(4, 3);
TLP_Work.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TLP_Work.Name = "TLP_Work";
TLP_Work.RowCount = 1;
TLP_Work.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Work.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Work.Size = new System.Drawing.Size(579, 321);
TLP_Work.TabIndex = 2;
TC_Work.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Work.Location = new System.Drawing.Point(4, 3);
TC_Work.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Work.Multiline = true;
TC_Work.Name = "TC_Work";
TC_Work.SelectedIndex = 0;
TC_Work.Size = new System.Drawing.Size(579, 321);
TC_Work.TabIndex = 2;
//
// GB_Research
//
@ -474,9 +458,9 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown NUD_System;
private System.Windows.Forms.CheckBox CHK_CustomSystem;
private System.Windows.Forms.CheckBox CHK_CustomFlag;
private System.Windows.Forms.TableLayoutPanel TLP_Flags;
private System.Windows.Forms.TableLayoutPanel TLP_System;
private System.Windows.Forms.TableLayoutPanel TLP_Work;
private System.Windows.Forms.TabControl TC_Flags;
private System.Windows.Forms.TabControl TC_System;
private System.Windows.Forms.TabControl TC_Work;
private System.Windows.Forms.NumericUpDown NUD_WorkIndex;
}
}

View File

@ -26,6 +26,7 @@ public SAV_FlagWork8b(SAV8BS sav)
SAV = (SAV8BS)sav.Clone();
Origin = sav;
TC_Features.SelectedTab = GB_Research;
AllowDrop = true;
DragEnter += Main_DragEnter;
@ -42,6 +43,15 @@ public SAV_FlagWork8b(SAV8BS sav)
LoadFlags(editor);
LoadSystem(editor);
LoadWork(editor);
if (Application.IsDarkModeEnabled)
{
WinFormsTranslator.ReformatDark(TC_Flags);
WinFormsTranslator.ReformatDark(TC_System);
WinFormsTranslator.ReformatDark(TC_Work);
WinFormsTranslator.ReformatDark(TC_Features);
}
editing = false;
ResumeLayout();
@ -57,160 +67,221 @@ public SAV_FlagWork8b(SAV8BS sav)
Text = $"{Text} ({sav.Version})";
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
TC_Features.SelectedIndex = 0;
}
private void LoadFlags(EventLabelCollectionSystem editor)
{
TLP_Flags.SuspendLayout();
TLP_Flags.Scroll += WinFormsUtil.PanelScroll;
TLP_Flags.Controls.Clear();
IEnumerable<NamedEventValue> labels = editor.Flag;
var hide = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.OrderByDescending(z => z.Type);
int i = 0;
foreach (var (name, index, type) in labels)
FlagDict.Clear();
TC_Flags.TabPages.Clear();
var labels = editor.Flag;
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
if (type < hide)
break;
var lbl = new Label { Text = name, Margin = Padding.Empty, AutoSize = true };
var chk = new CheckBox
var tab = new TabPage
{
CheckAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Checked = SAV.FlagWork.GetFlag(index),
AutoSize = true,
Name = $"Tab_F{group.Key}",
Text = group.Key.ToString(),
};
lbl.Click += (_, _) => chk.Checked ^= true;
chk.CheckedChanged += (_, _) =>
{
SAV.FlagWork.SetFlag(index, chk.Checked);
if (NUD_Flag.Value == index)
CHK_CustomFlag.Checked = chk.Checked;
};
TLP_Flags.Controls.Add(chk, 0, i);
TLP_Flags.Controls.Add(lbl, 1, i);
FlagDict.Add(index, chk);
i++;
var panel = CreateBoolPanel($"TLP_F{group.Key}");
tab.Controls.Add(panel);
TC_Flags.TabPages.Add(tab);
int i = 0;
foreach (var (name, index, _) in group)
{
var lbl = new Label { Text = name, Margin = Padding.Empty, AutoSize = true };
var chk = new CheckBox
{
CheckAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Checked = SAV.FlagWork.GetFlag(index),
AutoSize = true,
};
lbl.Click += (_, _) => chk.Checked ^= true;
chk.CheckedChanged += (_, _) =>
{
SAV.FlagWork.SetFlag(index, chk.Checked);
if (NUD_Flag.Value == index)
CHK_CustomFlag.Checked = chk.Checked;
};
panel.Controls.Add(chk, 0, i);
panel.Controls.Add(lbl, 1, i);
FlagDict.Add(index, chk);
i++;
}
}
TLP_Flags.ResumeLayout();
}
private void LoadSystem(EventLabelCollectionSystem editor)
{
TLP_System.SuspendLayout();
TLP_System.Scroll += WinFormsUtil.PanelScroll;
TLP_System.Controls.Clear();
IEnumerable<NamedEventValue> labels = editor.System;
var hide = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.OrderByDescending(z => z.Type);
int i = 0;
foreach (var (name, index, type) in labels)
SystemDict.Clear();
TC_System.TabPages.Clear();
var labels = editor.System;
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
if (type < hide)
break;
var lbl = new Label { Text = name, Margin = Padding.Empty, AutoSize = true };
var chk = new CheckBox
var tab = new TabPage
{
CheckAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Checked = SAV.FlagWork.GetSystemFlag(index),
AutoSize = true,
Name = $"Tab_S{group.Key}",
Text = group.Key.ToString(),
};
lbl.Click += (_, _) => chk.Checked ^= true;
chk.CheckedChanged += (_, _) =>
{
SAV.FlagWork.SetSystemFlag(index, chk.Checked);
if (NUD_System.Value == index)
CHK_CustomSystem.Checked = chk.Checked;
};
TLP_System.Controls.Add(chk, 0, i);
TLP_System.Controls.Add(lbl, 1, i);
SystemDict.Add(index, chk);
i++;
var panel = CreateBoolPanel($"TLP_S{group.Key}");
tab.Controls.Add(panel);
TC_System.TabPages.Add(tab);
int i = 0;
foreach (var (name, index, _) in group)
{
var lbl = new Label { Text = name, Margin = Padding.Empty, AutoSize = true };
var chk = new CheckBox
{
CheckAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Checked = SAV.FlagWork.GetSystemFlag(index),
AutoSize = true,
};
lbl.Click += (_, _) => chk.Checked ^= true;
chk.CheckedChanged += (_, _) =>
{
SAV.FlagWork.SetSystemFlag(index, chk.Checked);
if (NUD_System.Value == index)
CHK_CustomSystem.Checked = chk.Checked;
};
panel.Controls.Add(chk, 0, i);
panel.Controls.Add(lbl, 1, i);
SystemDict.Add(index, chk);
i++;
}
}
TLP_System.ResumeLayout();
}
private void LoadWork(EventLabelCollectionSystem editor)
{
TLP_Work.SuspendLayout();
TLP_Work.Scroll += WinFormsUtil.PanelScroll;
TLP_Work.Controls.Clear();
IEnumerable<NamedEventWork> labels = editor.Work;
var hide = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.OrderByDescending(z => z.Type);
int i = 0;
foreach (var entry in labels)
WorkDict.Clear();
TC_Work.TabPages.Clear();
var labels = editor.Work;
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
if (entry.Type < hide)
break;
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
var tab = new TabPage
{
Maximum = int.MaxValue,
Minimum = int.MinValue,
Margin = Padding.Empty,
Width = 85,
Name = $"Tab_W{group.Key}",
Text = group.Key.ToString(),
};
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
var panel = CreateWorkPanel($"TLP_W{group.Key}");
tab.Controls.Add(panel);
TC_Work.TabPages.Add(tab);
int i = 0;
foreach (var entry in group)
{
Margin = Padding.Empty,
Width = 165,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
DropDownWidth = Width + 100,
};
cb.InitializeBinding();
cb.DataSource = map;
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
{
Maximum = int.MaxValue,
Minimum = int.MinValue,
Margin = Padding.Empty,
Width = 85,
};
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
{
Margin = Padding.Empty,
Width = 165,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
DropDownWidth = Width + 100,
};
if (Application.IsDarkModeEnabled)
WinFormsTranslator.ReformatDark(cb);
cb.InitializeBinding();
cb.DataSource = map;
updating = true;
var value = (int)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
SAV.FlagWork.SetWork(entry.Index, value);
if (NUD_WorkIndex.Value == entry.Index)
mtb.Text = ((int)mtb.Value).ToString();
updating = false;
updating = true;
var value = (int)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
SAV.FlagWork.SetWork(entry.Index, value);
if (NUD_WorkIndex.Value == entry.Index)
NUD_Work.Value = value;
updating = false;
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = SAV.FlagWork.GetWork(entry.Index);
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
panel.Controls.Add(lbl, 0, i);
panel.Controls.Add(cb, 1, i);
panel.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
i++;
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = SAV.FlagWork.GetWork(entry.Index);
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
TLP_Work.Controls.Add(lbl, 0, i);
TLP_Work.Controls.Add(cb, 1, i);
TLP_Work.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
i++;
}
}
TLP_Work.ResumeLayout();
private static TableLayoutPanel CreateBoolPanel(string name)
{
var panel = new TableLayoutPanel
{
AutoScroll = true,
ColumnCount = 2,
Dock = DockStyle.Fill,
Margin = new Padding(4, 3, 4, 3),
Name = name,
RowCount = 2,
};
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle());
panel.RowStyles.Add(new RowStyle());
panel.RowStyles.Add(new RowStyle());
panel.Scroll += WinFormsUtil.PanelScroll;
return panel;
}
private static TableLayoutPanel CreateWorkPanel(string name)
{
var panel = new TableLayoutPanel
{
AutoScroll = true,
ColumnCount = 3,
Dock = DockStyle.Fill,
Margin = new Padding(4, 3, 4, 3),
Name = name,
RowCount = 1,
};
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 579F));
panel.RowStyles.Add(new RowStyle());
panel.RowStyles.Add(new RowStyle());
panel.Scroll += WinFormsUtil.PanelScroll;
return panel;
}
private void B_Cancel_Click(object sender, EventArgs e)

View File

@ -1,5 +1,3 @@
using PKHeX.WinForms.Controls;
namespace PKHeX.WinForms
{
sealed partial class SAV_EventFlags
@ -51,16 +49,15 @@ private void InitializeComponent()
L_EventFlagWarn = new System.Windows.Forms.Label();
tabControl1 = new System.Windows.Forms.TabControl();
GB_Flags = new System.Windows.Forms.TabPage();
dgv = new DoubleBufferedDataGridView();
TC_Flags = new System.Windows.Forms.TabControl();
GB_Constants = new System.Windows.Forms.TabPage();
TLP_Const = new System.Windows.Forms.TableLayoutPanel();
TC_Const = new System.Windows.Forms.TabControl();
GB_Research = new System.Windows.Forms.TabPage();
GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)NUD_Flag).BeginInit();
GB_Researcher.SuspendLayout();
tabControl1.SuspendLayout();
GB_Flags.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgv).BeginInit();
GB_Constants.SuspendLayout();
GB_Research.SuspendLayout();
SuspendLayout();
@ -306,7 +303,7 @@ private void InitializeComponent()
//
// GB_Flags
//
GB_Flags.Controls.Add(dgv);
GB_Flags.Controls.Add(TC_Flags);
GB_Flags.Location = new System.Drawing.Point(4, 24);
GB_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Flags.Name = "GB_Flags";
@ -315,32 +312,20 @@ private void InitializeComponent()
GB_Flags.Text = "Event Flags";
GB_Flags.UseVisualStyleBackColor = true;
//
// dgv
// TC_Flags
//
dgv.AllowUserToAddRows = false;
dgv.AllowUserToDeleteRows = false;
dgv.AllowUserToResizeColumns = false;
dgv.AllowUserToResizeRows = false;
dgv.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
dgv.BorderStyle = System.Windows.Forms.BorderStyle.None;
dgv.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgv.ColumnHeadersVisible = false;
dgv.Dock = System.Windows.Forms.DockStyle.Fill;
dgv.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
dgv.Location = new System.Drawing.Point(0, 0);
dgv.Margin = new System.Windows.Forms.Padding(0);
dgv.MultiSelect = false;
dgv.Name = "dgv";
dgv.RowHeadersVisible = false;
dgv.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
dgv.ShowEditingIcon = false;
dgv.Size = new System.Drawing.Size(494, 329);
dgv.TabIndex = 12;
TC_Flags.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Flags.Location = new System.Drawing.Point(0, 0);
TC_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Flags.Multiline = true;
TC_Flags.Name = "TC_Flags";
TC_Flags.SelectedIndex = 0;
TC_Flags.Size = new System.Drawing.Size(494, 329);
TC_Flags.TabIndex = 12;
//
// GB_Constants
//
GB_Constants.Controls.Add(TLP_Const);
GB_Constants.Controls.Add(TC_Const);
GB_Constants.Location = new System.Drawing.Point(4, 24);
GB_Constants.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Constants.Name = "GB_Constants";
@ -350,22 +335,16 @@ private void InitializeComponent()
GB_Constants.Text = "Event Constants";
GB_Constants.UseVisualStyleBackColor = true;
//
// TLP_Const
// TC_Const
//
TLP_Const.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
TLP_Const.AutoScroll = true;
TLP_Const.ColumnCount = 3;
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 485F));
TLP_Const.Location = new System.Drawing.Point(4, 3);
TLP_Const.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TLP_Const.Name = "TLP_Const";
TLP_Const.RowCount = 1;
TLP_Const.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Const.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Const.Size = new System.Drawing.Size(485, 320);
TLP_Const.TabIndex = 1;
TC_Const.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Const.Location = new System.Drawing.Point(4, 3);
TC_Const.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Const.Multiline = true;
TC_Const.Name = "TC_Const";
TC_Const.SelectedIndex = 0;
TC_Const.Size = new System.Drawing.Size(486, 323);
TC_Const.TabIndex = 1;
//
// GB_Research
//
@ -404,7 +383,6 @@ private void InitializeComponent()
GB_Researcher.PerformLayout();
tabControl1.ResumeLayout(false);
GB_Flags.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dgv).EndInit();
GB_Constants.ResumeLayout(false);
GB_Research.ResumeLayout(false);
ResumeLayout(false);
@ -435,7 +413,7 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage GB_Flags;
private System.Windows.Forms.TabPage GB_Constants;
private System.Windows.Forms.TabPage GB_Research;
private System.Windows.Forms.TableLayoutPanel TLP_Const;
private DoubleBufferedDataGridView dgv;
private System.Windows.Forms.TabControl TC_Flags;
private System.Windows.Forms.TabControl TC_Const;
}
}

View File

@ -4,6 +4,7 @@
using System.Linq;
using System.Windows.Forms;
using PKHeX.Core;
using PKHeX.WinForms.Controls;
using static PKHeX.Core.MessageStrings;
namespace PKHeX.WinForms;
@ -12,7 +13,7 @@ public sealed partial class SAV_EventFlags : Form
{
private readonly EventWorkspace<IEventFlag37, ushort> Editor;
private readonly Dictionary<int, NumericUpDown> WorkDict = [];
private readonly Dictionary<int, int> FlagDict = [];
private readonly Dictionary<int, (DataGridView Grid, int RowIndex)> FlagDict = [];
private bool editing;
@ -25,21 +26,21 @@ public SAV_EventFlags(IEventFlag37 sav, GameVersion version)
AllowDrop = true;
DragEnter += Main_DragEnter;
DragDrop += Main_DragDrop;
tabControl1.SelectedTab = GB_Research; // hack to get the first tab to render in dark mode correctly
editing = true;
CB_Stats.Items.Clear();
for (int i = 0; i < editor.Values.Length; i++)
CB_Stats.Items.Add(i.ToString());
dgv.SuspendLayout();
TLP_Const.SuspendLayout();
TLP_Const.Scroll += WinFormsUtil.PanelScroll;
TLP_Const.Controls.Clear();
AddFlagList(editor.Labels, editor.Flags);
AddConstList(editor.Labels, editor.Values);
dgv.ResumeLayout();
TLP_Const.ResumeLayout();
if (Application.IsDarkModeEnabled)
{
WinFormsTranslator.ReformatDark(TC_Flags);
WinFormsTranslator.ReformatDark(TC_Const);
}
Text = $"{Text} ({version})";
@ -58,6 +59,12 @@ public SAV_EventFlags(IEventFlag37 sav, GameVersion version)
editing = false;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
tabControl1.SelectedIndex = 0;
}
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
@ -71,161 +78,233 @@ private void B_Save_Click(object sender, EventArgs e)
private void AddFlagList(EventLabelCollection list, bool[] values)
{
FlagDict.Clear();
TC_Flags.TabPages.Clear();
var labels = list.Flag;
if (labels.Count == 0)
{
dgv.Visible = false;
TC_Flags.Visible = false;
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) };
GB_Flags.Controls.Add(research);
return;
}
var cFlag = new DataGridViewCheckBoxColumn
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
DisplayIndex = 0,
Width = 20,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
var cLabel = new DataGridViewTextBoxColumn
{
DisplayIndex = 1,
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
ReadOnly = true,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
cFlag.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
cLabel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
dgv.Columns.Add(cFlag);
dgv.Columns.Add(cLabel);
var hideBelow = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.Where(z => z.Type >= hideBelow).OrderByDescending(z => z.Type).ToList();
dgv.Rows.Add(labels.Count);
for (int i = 0; i < labels.Count; i++)
FlagDict[labels[i].Index] = i;
for (int i = 0; i < labels.Count; i++)
{
var (name, index, _) = labels[i];
var cells = dgv.Rows[i].Cells;
cells[0].Value = values[index];
cells[1].Value = name;
}
dgv.CellValueChanged += (_, e) =>
{
if (e.ColumnIndex != 0 || e.RowIndex == -1)
return;
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
var index = labels[e.RowIndex].Index;
values[index] = chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = chk;
};
dgv.CellMouseUp += (_, e) =>
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex == 0)
var tab = new TabPage
{
dgv.EndEdit();
return;
Name = $"Tab_F{group.Key}",
Text = WinFormsTranslator.TranslateEnum(group.Key, Main.CurrentLanguage),
};
TC_Flags.TabPages.Add(tab);
var grid = CreateFlagGrid();
tab.Controls.Add(grid);
var cFlag = new DataGridViewCheckBoxColumn
{
DisplayIndex = 0,
Width = 20,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
var cLabel = new DataGridViewTextBoxColumn
{
DisplayIndex = 1,
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
ReadOnly = true,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
cFlag.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
cLabel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
grid.Columns.Add(cFlag);
grid.Columns.Add(cLabel);
var grouped = group.ToList();
grid.Rows.Add(grouped.Count);
for (var i = 0; i < grouped.Count; i++)
FlagDict[grouped[i].Index] = (grid, i);
for (var i = 0; i < grouped.Count; i++)
{
var (name, index, _) = grouped[i];
var cells = grid.Rows[i].Cells;
cells[0].Value = values[index];
cells[1].Value = name;
}
if (e.ColumnIndex != 1)
return;
grid.CellValueChanged += (_, e) =>
{
if (e.ColumnIndex != 0 || e.RowIndex == -1)
return;
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
var index = labels[e.RowIndex].Index;
values[index] = !chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = !chk;
};
var chk = (bool)grid.Rows[e.RowIndex].Cells[0].Value!;
var index = grouped[e.RowIndex].Index;
values[index] = chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = chk;
};
grid.CellMouseUp += (_, e) =>
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex == 0)
{
grid.EndEdit();
return;
}
if (e.ColumnIndex != 1)
return;
var chk = (bool)grid.Rows[e.RowIndex].Cells[0].Value!;
grid.Rows[e.RowIndex].Cells[0].Value = !chk;
var index = grouped[e.RowIndex].Index;
values[index] = !chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = !chk;
};
}
}
private static DoubleBufferedDataGridView CreateFlagGrid() => new()
{
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
AllowUserToResizeColumns = false,
AllowUserToResizeRows = false,
BackgroundColor = SystemColors.ControlLightLight,
BorderStyle = BorderStyle.None,
ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single,
ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
ColumnHeadersVisible = false,
Dock = DockStyle.Fill,
EditMode = DataGridViewEditMode.EditOnEnter,
Margin = Padding.Empty,
MultiSelect = false,
RowHeadersVisible = false,
SelectionMode = DataGridViewSelectionMode.CellSelect,
ShowEditingIcon = false,
};
private void AddConstList(EventLabelCollection list, ushort[] values)
{
WorkDict.Clear();
TC_Const.TabPages.Clear();
var labels = list.Work;
if (labels.Count == 0)
{
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true }, 0, 0);
TC_Const.Visible = false;
GB_Constants.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) });
return;
}
var hide = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.OrderByDescending(z => z.Type).ToList();
for (var i = 0; i < labels.Count; i++)
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
var entry = labels[i];
if (entry.Type < hide)
break;
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
var tab = new TabPage
{
Maximum = ushort.MaxValue,
Minimum = ushort.MinValue,
Margin = Padding.Empty,
Width = 50,
Name = $"Tab_W{group.Key}",
Text = WinFormsTranslator.TranslateEnum(group.Key, Main.CurrentLanguage),
};
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
var panel = CreateConstPanel();
tab.Controls.Add(panel);
TC_Const.TabPages.Add(tab);
var grouped = group.ToList();
for (var i = 0; i < grouped.Count; i++)
{
Margin = Padding.Empty,
Width = 150,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
};
var font = cb.Font;
cb.DropDownWidth = entry.PredefinedValues.Max(z => TextRenderer.MeasureText(z.Name, font).Width);
cb.InitializeBinding();
cb.DataSource = map;
var entry = grouped[i];
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
{
Maximum = ushort.MaxValue,
Minimum = ushort.MinValue,
Margin = Padding.Empty,
Width = 50,
};
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
{
Margin = Padding.Empty,
Width = 150,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
};
if (Application.IsDarkModeEnabled)
WinFormsTranslator.ReformatDark(cb);
var font = cb.Font;
cb.DropDownWidth = entry.PredefinedValues.Max(z => TextRenderer.MeasureText(z.Name, font).Width);
cb.InitializeBinding();
cb.DataSource = map;
updating = true;
var value = (ushort)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
Editor.Values[entry.Index] = value;
if (CB_Stats.SelectedIndex == entry.Index)
MT_Stat.Text = ((int)mtb.Value).ToString();
updating = false;
updating = true;
var value = (ushort)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
Editor.Values[entry.Index] = value;
if (CB_Stats.SelectedIndex == entry.Index)
MT_Stat.Text = ((int)mtb.Value).ToString();
updating = false;
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = values[entry.Index];
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
panel.Controls.Add(lbl, 0, i);
panel.Controls.Add(cb, 1, i);
panel.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = values[entry.Index];
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
TLP_Const.Controls.Add(lbl, 0, i);
TLP_Const.Controls.Add(cb, 1, i);
TLP_Const.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
}
}
private static TableLayoutPanel CreateConstPanel()
{
var panel = new TableLayoutPanel
{
AutoScroll = true,
ColumnCount = 3,
Dock = DockStyle.Fill,
Margin = new Padding(4),
Name = "TLP_Const",
RowCount = 1,
};
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 485F));
panel.RowStyles.Add(new RowStyle());
panel.RowStyles.Add(new RowStyle());
panel.Scroll += WinFormsUtil.PanelScroll;
return panel;
}
private void ChangeCustomBool(object sender, EventArgs e)
{
if (editing)
@ -233,8 +312,8 @@ private void ChangeCustomBool(object sender, EventArgs e)
editing = true;
var index = (int)NUD_Flag.Value;
Editor.Flags[index] = c_CustomFlag.Checked;
if (FlagDict.TryGetValue(index, out var rowIndex))
dgv.Rows[rowIndex].Cells[0].Value = c_CustomFlag.Checked;
if (FlagDict.TryGetValue(index, out var result))
result.Grid.Rows[result.RowIndex].Cells[0].Value = c_CustomFlag.Checked;
editing = false;
}

View File

@ -1,5 +1,3 @@
using PKHeX.WinForms.Controls;
namespace PKHeX.WinForms
{
sealed partial class SAV_EventFlags2
@ -51,16 +49,15 @@ private void InitializeComponent()
L_EventFlagWarn = new System.Windows.Forms.Label();
tabControl1 = new System.Windows.Forms.TabControl();
GB_Flags = new System.Windows.Forms.TabPage();
dgv = new DoubleBufferedDataGridView();
TC_Flags = new System.Windows.Forms.TabControl();
GB_Constants = new System.Windows.Forms.TabPage();
TLP_Const = new System.Windows.Forms.TableLayoutPanel();
TC_Const = new System.Windows.Forms.TabControl();
GB_Research = new System.Windows.Forms.TabPage();
GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)NUD_Flag).BeginInit();
GB_Researcher.SuspendLayout();
tabControl1.SuspendLayout();
GB_Flags.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgv).BeginInit();
GB_Constants.SuspendLayout();
GB_Research.SuspendLayout();
SuspendLayout();
@ -306,7 +303,7 @@ private void InitializeComponent()
//
// GB_Flags
//
GB_Flags.Controls.Add(dgv);
GB_Flags.Controls.Add(TC_Flags);
GB_Flags.Location = new System.Drawing.Point(4, 24);
GB_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Flags.Name = "GB_Flags";
@ -315,32 +312,20 @@ private void InitializeComponent()
GB_Flags.Text = "Event Flags";
GB_Flags.UseVisualStyleBackColor = true;
//
// dgv
// TC_Flags
//
dgv.AllowUserToAddRows = false;
dgv.AllowUserToDeleteRows = false;
dgv.AllowUserToResizeColumns = false;
dgv.AllowUserToResizeRows = false;
dgv.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
dgv.BorderStyle = System.Windows.Forms.BorderStyle.None;
dgv.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgv.ColumnHeadersVisible = false;
dgv.Dock = System.Windows.Forms.DockStyle.Fill;
dgv.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
dgv.Location = new System.Drawing.Point(0, 0);
dgv.Margin = new System.Windows.Forms.Padding(0);
dgv.MultiSelect = false;
dgv.Name = "dgv";
dgv.RowHeadersVisible = false;
dgv.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
dgv.ShowEditingIcon = false;
dgv.Size = new System.Drawing.Size(494, 329);
dgv.TabIndex = 12;
TC_Flags.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Flags.Location = new System.Drawing.Point(0, 0);
TC_Flags.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Flags.Multiline = true;
TC_Flags.Name = "TC_Flags";
TC_Flags.SelectedIndex = 0;
TC_Flags.Size = new System.Drawing.Size(494, 329);
TC_Flags.TabIndex = 12;
//
// GB_Constants
//
GB_Constants.Controls.Add(TLP_Const);
GB_Constants.Controls.Add(TC_Const);
GB_Constants.Location = new System.Drawing.Point(4, 24);
GB_Constants.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
GB_Constants.Name = "GB_Constants";
@ -350,22 +335,16 @@ private void InitializeComponent()
GB_Constants.Text = "Event Constants";
GB_Constants.UseVisualStyleBackColor = true;
//
// TLP_Const
// TC_Const
//
TLP_Const.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
TLP_Const.AutoScroll = true;
TLP_Const.ColumnCount = 3;
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 485F));
TLP_Const.Location = new System.Drawing.Point(4, 3);
TLP_Const.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TLP_Const.Name = "TLP_Const";
TLP_Const.RowCount = 1;
TLP_Const.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Const.RowStyles.Add(new System.Windows.Forms.RowStyle());
TLP_Const.Size = new System.Drawing.Size(485, 320);
TLP_Const.TabIndex = 1;
TC_Const.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Const.Location = new System.Drawing.Point(4, 3);
TC_Const.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Const.Multiline = true;
TC_Const.Name = "TC_Const";
TC_Const.SelectedIndex = 0;
TC_Const.Size = new System.Drawing.Size(486, 323);
TC_Const.TabIndex = 1;
//
// GB_Research
//
@ -404,7 +383,6 @@ private void InitializeComponent()
GB_Researcher.PerformLayout();
tabControl1.ResumeLayout(false);
GB_Flags.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dgv).EndInit();
GB_Constants.ResumeLayout(false);
GB_Research.ResumeLayout(false);
ResumeLayout(false);
@ -435,7 +413,7 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage GB_Flags;
private System.Windows.Forms.TabPage GB_Constants;
private System.Windows.Forms.TabPage GB_Research;
private System.Windows.Forms.TableLayoutPanel TLP_Const;
private DoubleBufferedDataGridView dgv;
private System.Windows.Forms.TabControl TC_Flags;
private System.Windows.Forms.TabControl TC_Const;
}
}

View File

@ -4,6 +4,7 @@
using System.Linq;
using System.Windows.Forms;
using PKHeX.Core;
using PKHeX.WinForms.Controls;
using static PKHeX.Core.MessageStrings;
namespace PKHeX.WinForms;
@ -12,7 +13,7 @@ public sealed partial class SAV_EventFlags2 : Form
{
private readonly EventWorkspace<SAV2, byte> Editor;
private readonly Dictionary<int, NumericUpDown> WorkDict = [];
private readonly Dictionary<int, int> FlagDict = [];
private readonly Dictionary<int, (DataGridView Grid, int RowIndex)> FlagDict = [];
private bool editing;
@ -25,21 +26,26 @@ public SAV_EventFlags2(SAV2 sav)
AllowDrop = true;
DragEnter += Main_DragEnter;
DragDrop += Main_DragDrop;
tabControl1.SelectedTab = GB_Research;
editing = true;
CB_Stats.Items.Clear();
for (int i = 0; i < editor.Values.Length; i++)
CB_Stats.Items.Add(i.ToString());
dgv.SuspendLayout();
TLP_Const.SuspendLayout();
TLP_Const.Scroll += WinFormsUtil.PanelScroll;
TLP_Const.Controls.Clear();
TC_Flags.SuspendLayout();
TC_Const.SuspendLayout();
AddFlagList(editor.Labels, editor.Flags);
AddConstList(editor.Labels, editor.Values);
dgv.ResumeLayout();
TLP_Const.ResumeLayout();
if (Application.IsDarkModeEnabled)
{
WinFormsTranslator.ReformatDark(TC_Flags);
WinFormsTranslator.ReformatDark(TC_Const);
}
TC_Flags.ResumeLayout();
TC_Const.ResumeLayout();
Text = $"{Text} ({sav.Version})";
@ -58,6 +64,12 @@ public SAV_EventFlags2(SAV2 sav)
editing = false;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
tabControl1.SelectedIndex = 0;
}
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
@ -71,160 +83,232 @@ private void B_Save_Click(object sender, EventArgs e)
private void AddFlagList(EventLabelCollection list, bool[] values)
{
FlagDict.Clear();
TC_Flags.TabPages.Clear();
var labels = list.Flag;
if (labels.Count == 0)
{
dgv.Visible = false;
TC_Flags.Visible = false;
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) };
GB_Flags.Controls.Add(research);
return;
}
var cFlag = new DataGridViewCheckBoxColumn
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
DisplayIndex = 0,
Width = 20,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
var cLabel = new DataGridViewTextBoxColumn
{
DisplayIndex = 1,
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
ReadOnly = true,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
cFlag.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
cLabel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
dgv.Columns.Add(cFlag);
dgv.Columns.Add(cLabel);
var hideBelow = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.Where(z => z.Type >= hideBelow).OrderByDescending(z => z.Type).ToList();
dgv.Rows.Add(labels.Count);
for (int i = 0; i < labels.Count; i++)
FlagDict[labels[i].Index] = i;
for (int i = 0; i < labels.Count; i++)
{
var (name, index, _) = labels[i];
var cells = dgv.Rows[i].Cells;
cells[0].Value = values[index];
cells[1].Value = name;
}
dgv.CellValueChanged += (_, e) =>
{
if (e.ColumnIndex != 0 || e.RowIndex == -1)
return;
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
var index = labels[e.RowIndex].Index;
values[index] = chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = chk;
};
dgv.CellMouseUp += (_, e) =>
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex == 0)
var tab = new TabPage
{
dgv.EndEdit();
return;
Name = $"Tab_F{group.Key}",
Text = group.Key.ToString(),
};
var grid = CreateFlagGrid();
tab.Controls.Add(grid);
TC_Flags.TabPages.Add(tab);
var cFlag = new DataGridViewCheckBoxColumn
{
DisplayIndex = 0,
Width = 20,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
var cLabel = new DataGridViewTextBoxColumn
{
DisplayIndex = 1,
AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
ReadOnly = true,
SortMode = DataGridViewColumnSortMode.NotSortable,
};
cFlag.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
cLabel.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
grid.Columns.Add(cFlag);
grid.Columns.Add(cLabel);
var grouped = group.ToList();
grid.Rows.Add(grouped.Count);
for (var i = 0; i < grouped.Count; i++)
FlagDict[grouped[i].Index] = (grid, i);
for (var i = 0; i < grouped.Count; i++)
{
var (name, index, _) = grouped[i];
var cells = grid.Rows[i].Cells;
cells[0].Value = values[index];
cells[1].Value = name;
}
if (e.ColumnIndex != 1)
return;
grid.CellValueChanged += (_, e) =>
{
if (e.ColumnIndex != 0 || e.RowIndex == -1)
return;
bool chk = (bool)dgv.Rows[e.RowIndex].Cells[0].Value!;
dgv.Rows[e.RowIndex].Cells[0].Value = !chk;
var index = labels[e.RowIndex].Index;
values[index] = !chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = !chk;
};
var chk = (bool)grid.Rows[e.RowIndex].Cells[0].Value!;
var index = grouped[e.RowIndex].Index;
values[index] = chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = chk;
};
grid.CellMouseUp += (_, e) =>
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex == 0)
{
grid.EndEdit();
return;
}
if (e.ColumnIndex != 1)
return;
var chk = (bool)grid.Rows[e.RowIndex].Cells[0].Value!;
grid.Rows[e.RowIndex].Cells[0].Value = !chk;
var index = grouped[e.RowIndex].Index;
values[index] = !chk;
if (NUD_Flag.Value == index)
c_CustomFlag.Checked = !chk;
};
}
}
private static DoubleBufferedDataGridView CreateFlagGrid() => new()
{
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
AllowUserToResizeColumns = false,
AllowUserToResizeRows = false,
BackgroundColor = SystemColors.ControlLightLight,
BorderStyle = BorderStyle.None,
ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single,
ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
ColumnHeadersVisible = false,
Dock = DockStyle.Fill,
EditMode = DataGridViewEditMode.EditOnEnter,
Margin = Padding.Empty,
MultiSelect = false,
RowHeadersVisible = false,
SelectionMode = DataGridViewSelectionMode.CellSelect,
ShowEditingIcon = false,
};
private void AddConstList(EventLabelCollection list, ReadOnlySpan<byte> values)
{
WorkDict.Clear();
TC_Const.TabPages.Clear();
var labels = list.Work;
if (labels.Count == 0)
{
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true }, 0, 0);
TC_Const.Visible = false;
GB_Constants.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) });
return;
}
var hide = Main.Settings.Advanced.HideEventTypeBelow;
labels = labels.OrderByDescending(z => z.Type).ToList();
for (var i = 0; i < labels.Count; i++)
foreach (var group in labels.GroupBy(z => z.Type).OrderBy(z => (int)z.Key))
{
var entry = labels[i];
if (entry.Type < hide)
break;
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
var tab = new TabPage
{
Maximum = ushort.MaxValue,
Minimum = ushort.MinValue,
Margin = Padding.Empty,
Width = 50,
Name = $"Tab_W{group.Key}",
Text = WinFormsTranslator.TranslateEnum(group.Key, Main.CurrentLanguage),
};
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
var panel = CreateConstPanel();
tab.Controls.Add(panel);
TC_Const.TabPages.Add(tab);
var grouped = group.ToList();
for (var i = 0; i < grouped.Count; i++)
{
Margin = Padding.Empty,
Width = 150,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
DropDownWidth = Width + 100,
};
cb.InitializeBinding();
cb.DataSource = map;
var entry = grouped[i];
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
{
Maximum = byte.MaxValue,
Minimum = byte.MinValue,
Margin = Padding.Empty,
Width = 50,
};
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
var map = entry.PredefinedValues.Select(z => new ComboItem(z.Name, z.Value)).ToList();
var cb = new ComboBox
{
Margin = Padding.Empty,
Width = 150,
DropDownStyle = ComboBoxStyle.DropDownList,
BindingContext = BindingContext,
DropDownWidth = Width + 100,
};
if (Application.IsDarkModeEnabled)
WinFormsTranslator.ReformatDark(cb);
cb.InitializeBinding();
cb.DataSource = map;
updating = true;
var value = (byte)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
lbl.Click += (_, _) => mtb.Value = 0;
bool updating = false;
mtb.ValueChanged += ChangeConstValue;
void ChangeConstValue(object? sender, EventArgs e)
{
if (updating)
return;
Editor.Values[entry.Index] = value;
if (CB_Stats.SelectedIndex == entry.Index)
MT_Stat.Text = ((int)mtb.Value).ToString();
updating = false;
updating = true;
var value = (byte)mtb.Value;
var (_, valueID) = map.Find(z => z.Value == value) ?? map[0];
if (WinFormsUtil.GetIndex(cb) != valueID)
cb.SelectedValue = valueID;
Editor.Values[entry.Index] = value;
if (CB_Stats.SelectedIndex == entry.Index)
MT_Stat.Text = ((int)mtb.Value).ToString();
updating = false;
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = values[entry.Index];
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
panel.Controls.Add(lbl, 0, i);
panel.Controls.Add(cb, 1, i);
panel.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
}
cb.SelectedValueChanged += (_, _) =>
{
if (editing || updating)
return;
var value = WinFormsUtil.GetIndex(cb);
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
};
mtb.Value = values[entry.Index];
if (mtb.Value == 0)
ChangeConstValue(this, EventArgs.Empty);
TLP_Const.Controls.Add(lbl, 0, i);
TLP_Const.Controls.Add(cb, 1, i);
TLP_Const.Controls.Add(mtb, 2, i);
WorkDict.Add(entry.Index, mtb);
}
}
private static TableLayoutPanel CreateConstPanel()
{
var panel = new TableLayoutPanel
{
AutoScroll = true,
ColumnCount = 3,
Dock = DockStyle.Fill,
Margin = new Padding(4, 3, 4, 3),
Name = "TLP_Const",
RowCount = 1,
};
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle());
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 485F));
panel.RowStyles.Add(new RowStyle());
panel.RowStyles.Add(new RowStyle());
panel.Scroll += WinFormsUtil.PanelScroll;
return panel;
}
private void ChangeCustomBool(object sender, EventArgs e)
{
if (editing)
@ -232,8 +316,8 @@ private void ChangeCustomBool(object sender, EventArgs e)
editing = true;
var index = (int)NUD_Flag.Value;
Editor.Flags[index] = c_CustomFlag.Checked;
if (FlagDict.TryGetValue(index, out var rowIndex))
dgv.Rows[rowIndex].Cells[0].Value = c_CustomFlag.Checked;
if (FlagDict.TryGetValue(index, out var result))
result.Grid.Rows[result.RowIndex].Cells[0].Value = c_CustomFlag.Checked;
editing = false;
}

View File

@ -305,6 +305,7 @@ private void InitializeComponent()
TC_Flag.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Flag.Location = new System.Drawing.Point(4, 3);
TC_Flag.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Flag.Multiline = true;
TC_Flag.Name = "TC_Flag";
TC_Flag.SelectedIndex = 0;
TC_Flag.Size = new System.Drawing.Size(486, 323);
@ -327,6 +328,7 @@ private void InitializeComponent()
TC_Work.Dock = System.Windows.Forms.DockStyle.Fill;
TC_Work.Location = new System.Drawing.Point(4, 3);
TC_Work.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
TC_Work.Multiline = true;
TC_Work.Name = "TC_Work";
TC_Work.SelectedIndex = 0;
TC_Work.Size = new System.Drawing.Size(486, 323);

View File

@ -23,6 +23,7 @@ public SAV_EventWork(SAV7b sav)
SAV = sav.Blocks.EventWork;
Origin = sav;
TC_Features.SelectedTab = GB_Research;
AllowDrop = true;
DragEnter += Main_DragEnter;
@ -43,8 +44,9 @@ public SAV_EventWork(SAV7b sav)
editing = false;
if (Application.IsDarkModeEnabled)
{
foreach (TabPage tab in TC_Features.TabPages)
tab.UseVisualStyleBackColor = false;
WinFormsTranslator.ReformatDark(TC_Flag);
WinFormsTranslator.ReformatDark(TC_Work);
WinFormsTranslator.ReformatDark(TC_Features);
}
ResumeLayout();
@ -64,6 +66,12 @@ public SAV_EventWork(SAV7b sav)
Text = $"{Text} ({sav.Version})";
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
TC_Features.SelectedIndex = 0;
}
private void LoadFlags(IEnumerable<EventVarGroup> editorFlag)
{
foreach (var g in editorFlag)
@ -97,12 +105,8 @@ private void LoadFlags(IEnumerable<EventVarGroup> editorFlag)
var tab = new TabPage
{
Name = $"Tab_F{g.Type}",
Text = g.Type.ToString(),
Text = WinFormsTranslator.TranslateEnum(g.Type, Main.CurrentLanguage),
};
if (Application.IsDarkModeEnabled)
{
tab.UseVisualStyleBackColor = false;
}
tab.Controls.Add(tlp);
TC_Flag.Controls.Add(tab);
tlp.ResumeLayout();
@ -143,6 +147,8 @@ private void LoadWork(IEnumerable<EventVarGroup> editorWork)
BindingContext = BindingContext,
DropDownWidth = Width + 100,
};
if (Application.IsDarkModeEnabled)
WinFormsTranslator.ReformatDark(cb);
cb.InitializeBinding();
cb.DataSource = new BindingSource(f.Options.ConvertAll(z => new ComboItem(z.Text, z.Value)), string.Empty);
cb.SelectedValue = f.Value;
@ -188,20 +194,12 @@ private void LoadWork(IEnumerable<EventVarGroup> editorWork)
}
}
i++;
if (Application.IsDarkModeEnabled)
{
cb.FlatStyle = FlatStyle.Flat;
}
}
var tab = new TabPage
{
Name = $"Tab_W{g.Type}",
Text = g.Type.ToString(),
Text = WinFormsTranslator.TranslateEnum(g.Type, Main.CurrentLanguage),
};
if (Application.IsDarkModeEnabled)
{
tab.UseVisualStyleBackColor = false;
}
tab.Controls.Add(tlp);
TC_Work.Controls.Add(tab);
tlp.ResumeLayout();

View File

@ -190,6 +190,9 @@ private static void UpdateTranslations()
typeof(FestivalPlazaFacilityColor),
typeof(PlayerSkinColor8),
typeof(BattlePassType),
typeof(EventVarType),
typeof(NamedEventType),
];
/// <summary>

View File

@ -228,12 +228,6 @@ public static void ReformatDark(Control z)
}
}
public static void ReformatDark(PictureBox pb)
{
if (pb.Image is Bitmap bmp)
pb.Image = WinFormsUtil.BlackToWhite(bmp);
}
private static IEnumerable<T> GetChildrenOfType<T>(this Control control) where T : class
{
foreach (var child in control.Controls.OfType<Control>())