@@ -985,7 +985,7 @@ void CSettings::CreateGUI ( void )
985
985
);
986
986
987
987
// Add a small indent for edit boxes
988
- fIndentX += 20 .0f ;
988
+ fIndentX += 10 .0f ;
989
989
990
990
// Cache position and size from color tab panel (for positioning and height)
991
991
pColorTabPanel->GetPosition ( vecTemp );
@@ -1006,66 +1006,36 @@ void CSettings::CreateGUI ( void )
1006
1006
// Layout tab
1007
1007
CGUITab* pLayoutTab = pChatOptionsPanel->CreateTab ( _ (" Layout" ) );
1008
1008
1009
- pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, " X:" ) );
1010
- pLabel->SetPosition ( CVector2D ( 10 .0f , 10 .0f ) );
1011
- pLabel->GetPosition ( vecTemp );
1012
- pLabel->AutoSize ( );
1013
- pLabel->SetAlwaysOnTop ( true );
1014
-
1015
- m_pChatPosX = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1016
- m_pChatPosX->SetPosition ( CVector2D ( vecTemp.fX + 12 .0f , vecTemp.fY - 2 .0f ) );
1017
- m_pChatPosX->GetPosition ( vecTemp );
1018
- m_pChatPosX->SetSize ( CVector2D ( 70 .0f , 24 .0f ) );
1019
- m_pChatPosX->SetAlwaysOnTop ( true );
1020
-
1021
- pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, " Y:" ) );
1022
- pLabel->SetPosition ( CVector2D ( vecTemp.fX + 75 .0f , vecTemp.fY + 2 .0f ) );
1023
- pLabel->GetPosition ( vecTemp );
1024
- pLabel->AutoSize ( );
1025
- pLabel->SetAlwaysOnTop ( true );
1026
-
1027
- m_pChatPosY = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1028
- m_pChatPosY->SetPosition ( CVector2D ( vecTemp.fX + 12 .0f , vecTemp.fY - 2 .0f ) );
1029
- m_pChatPosY->SetSize ( CVector2D ( 70 .0f , 24 .0f ) );
1030
- m_pChatPosY->SetAlwaysOnTop ( true );
1031
-
1032
1009
pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, _ (" Lines:" ) ) );
1033
- pLabel->SetPosition ( CVector2D ( 10 .0f , vecTemp. fY + fLineSizeY + fLineGapY ) );
1010
+ pLabel->SetPosition ( CVector2D ( 10 .0f , 10 . 0f ) );
1034
1011
pLabel->GetPosition ( vecTemp );
1035
1012
pLabel->AutoSize ( );
1036
- pLabel->SetAlwaysOnTop ( true );
1037
1013
1038
1014
m_pChatLines = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1039
1015
m_pChatLines->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 2 .0f ) );
1040
1016
m_pChatLines->SetSize ( CVector2D ( 80 .0f , 24 .0f ) );
1041
- m_pChatLines->SetAlwaysOnTop ( true );
1042
1017
1043
1018
pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, _ (" Scale:" ) ) );
1044
1019
pLabel->SetPosition ( CVector2D ( vecTemp.fX , vecTemp.fY + fLineSizeY + fLineGapY ) );
1045
1020
pLabel->GetPosition ( vecTemp );
1046
1021
pLabel->AutoSize ( );
1047
- pLabel->SetAlwaysOnTop ( true );
1048
1022
1049
1023
m_pChatScaleX = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1050
1024
m_pChatScaleX->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 2 .0f ) );
1051
1025
m_pChatScaleX->SetSize ( CVector2D ( 35 .0f , 24 .0f ) );
1052
- m_pChatScaleX->SetAlwaysOnTop ( true );
1053
1026
1054
1027
pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, " x" ) );
1055
1028
pLabel->SetPosition ( CVector2D ( vecTemp.fX + fIndentX + 37 .0f , vecTemp.fY + 2 .0f ) );
1056
1029
pLabel->AutoSize ( );
1057
- pLabel->SetAlwaysOnTop ( true );
1058
1030
1059
1031
m_pChatScaleY = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1060
1032
m_pChatScaleY->SetPosition ( CVector2D ( vecTemp.fX + fIndentX + 45 .0f , vecTemp.fY - 2 .0f ) );
1061
1033
m_pChatScaleY->SetSize ( CVector2D ( 35 .0f , 24 .0f ) );
1062
- m_pChatScaleY->SetAlwaysOnTop ( true );
1063
1034
1064
1035
pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pLayoutTab, _ (" Width:" ) ) );
1065
1036
pLabel->SetPosition ( CVector2D ( vecTemp.fX , vecTemp.fY + fLineSizeY + fLineGapY ) );
1066
1037
pLabel->GetPosition ( vecTemp );
1067
1038
pLabel->AutoSize ( );
1068
- pLabel->SetAlwaysOnTop ( true );
1069
1039
1070
1040
m_pChatWidth = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pLayoutTab, " " ) );
1071
1041
m_pChatWidth->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 2 .0f ) );
@@ -1121,6 +1091,68 @@ void CSettings::CreateGUI ( void )
1121
1091
m_pChatCssText->GetPosition ().fY )
1122
1092
);
1123
1093
}
1094
+
1095
+ // Position tab
1096
+ float fComboWidth = 100 .0f ;
1097
+
1098
+ CGUITab* pPositionTab = pChatOptionsPanel->CreateTab ( _ (" Position" ) );
1099
+ pChatOptionsPanel->SetSelectedTab ( pPositionTab );
1100
+
1101
+ fIndentX = pManager->CGUI_GetMaxTextExtent ( " default-normal" ,
1102
+ _ (" Horizontal:" ),
1103
+ _ (" Vertical:" ),
1104
+ _ (" X-Offset:" ),
1105
+ _ (" Y-Offset:" )
1106
+ );
1107
+
1108
+ // Add a small indent for edit boxes
1109
+ fIndentX += 10 .0f ;
1110
+
1111
+ pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pPositionTab, _ (" Horizontal:" ) ) );
1112
+ pLabel->SetPosition ( CVector2D ( 10 .0f , 10 .0f ) );
1113
+ pLabel->GetPosition ( vecTemp );
1114
+ pLabel->AutoSize ( );
1115
+
1116
+ m_pChatHorizontalCombo = reinterpret_cast < CGUIComboBox* > ( pManager->CreateComboBox ( pPositionTab, " " ) );
1117
+ m_pChatHorizontalCombo->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 1 .0f ) );
1118
+ m_pChatHorizontalCombo->SetSize ( CVector2D ( fComboWidth , 85 .0f ) );
1119
+ m_pChatHorizontalCombo->AddItem ( _ (" Left" ) )->SetData ( (void *) Chat::Position::Horizontal::LEFT );
1120
+ m_pChatHorizontalCombo->AddItem ( _ (" Center" ) )->SetData ( (void *) Chat::Position::Horizontal::CENTER );
1121
+ m_pChatHorizontalCombo->AddItem ( _ (" Right" ) )->SetData ( (void *) Chat::Position::Horizontal::RIGHT );
1122
+ m_pChatHorizontalCombo->SetReadOnly ( true );
1123
+ m_pChatHorizontalCombo->SetSelectedItemByIndex ( 0 );
1124
+
1125
+ pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pPositionTab, _ (" Vertical:" ) ) );
1126
+ pLabel->SetPosition ( CVector2D ( vecTemp.fX , vecTemp.fY + fLineSizeY + fLineGapY ) );
1127
+ pLabel->GetPosition ( vecTemp );
1128
+ pLabel->AutoSize ( );
1129
+
1130
+ m_pChatVerticalCombo = reinterpret_cast < CGUIComboBox* > ( pManager->CreateComboBox ( pPositionTab, " " ) );
1131
+ m_pChatVerticalCombo->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 1 .0f ) );
1132
+ m_pChatVerticalCombo->SetSize ( CVector2D ( fComboWidth , 85 .0f ) );
1133
+ m_pChatVerticalCombo->AddItem ( _ (" Top" ) )->SetData ( (void *) Chat::Position::Vertical::TOP );
1134
+ m_pChatVerticalCombo->AddItem ( _ (" Center" ) )->SetData ( (void *) Chat::Position::Vertical::CENTER );
1135
+ m_pChatVerticalCombo->AddItem ( _ (" Bottom" ) )->SetData ( (void *) Chat::Position::Vertical::BOTTOM );
1136
+ m_pChatVerticalCombo->SetReadOnly ( true );
1137
+ m_pChatVerticalCombo->SetSelectedItemByIndex ( 0 );
1138
+
1139
+ pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pPositionTab, _ (" X-Offset:" ) ) );
1140
+ pLabel->SetPosition ( CVector2D ( vecTemp.fX , vecTemp.fY + fLineSizeY + fLineGapY ) );
1141
+ pLabel->GetPosition ( vecTemp );
1142
+ pLabel->AutoSize ( );
1143
+
1144
+ m_pChatOffsetX = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pPositionTab, " " ) );
1145
+ m_pChatOffsetX->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 2 .0f ) );
1146
+ m_pChatOffsetX->SetSize ( CVector2D ( fComboWidth , 24 .0f ) );
1147
+
1148
+ pLabel = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( pPositionTab, _ (" Y-Offset:" ) ) );
1149
+ pLabel->SetPosition ( CVector2D ( vecTemp.fX , vecTemp.fY + fLineSizeY + fLineGapY ) );
1150
+ pLabel->GetPosition ( vecTemp );
1151
+ pLabel->AutoSize ( );
1152
+
1153
+ m_pChatOffsetY = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( pPositionTab, " " ) );
1154
+ m_pChatOffsetY->SetPosition ( CVector2D ( vecTemp.fX + fIndentX , vecTemp.fY - 2 .0f ) );
1155
+ m_pChatOffsetY->SetSize ( CVector2D ( fComboWidth , 24 .0f ) );
1124
1156
1125
1157
// Cache position and size from font panel
1126
1158
m_pPaneChatFont->GetPosition ( vecTemp );
@@ -2905,8 +2937,6 @@ void CSettings::LoadData ( void )
2905
2937
{
2906
2938
}
2907
2939
2908
- CVARS_GET ( " chat_pos_x" , strVar ); m_pChatPosX->SetText ( strVar.c_str () );
2909
- CVARS_GET ( " chat_pos_y" , strVar ); m_pChatPosY->SetText ( strVar.c_str () );
2910
2940
CVARS_GET ( " chat_width" , strVar ); m_pChatWidth->SetText ( strVar.c_str () );
2911
2941
CVARS_GET ( " chat_css_style_text" , bVar ); m_pChatCssText->SetSelected ( bVar );
2912
2942
CVARS_GET ( " chat_css_style_background" , bVar ); m_pChatCssBackground->SetSelected ( bVar );
@@ -2920,7 +2950,21 @@ void CSettings::LoadData ( void )
2920
2950
CVARS_GET ( " chat_line_fade_out" , iVar );
2921
2951
SetMilliseconds ( m_pChatLineFadeout, iVar );
2922
2952
}
2923
-
2953
+
2954
+ // Chat position
2955
+ CVARS_GET ( " chat_position_horizontal" , iVar );
2956
+ if ( iVar > Chat::Position::Horizontal::RIGHT )
2957
+ iVar = Chat::Position::Horizontal::LEFT;
2958
+ m_pChatHorizontalCombo->SetSelectedItemByIndex ( iVar );
2959
+
2960
+ CVARS_GET ( " chat_position_vertical" , iVar );
2961
+ if ( iVar > Chat::Position::Vertical::BOTTOM )
2962
+ iVar = Chat::Position::Vertical::TOP;
2963
+ m_pChatVerticalCombo->SetSelectedItemByIndex ( iVar );
2964
+
2965
+ CVARS_GET ( " chat_position_offset_x" , strVar ); m_pChatOffsetX->SetText ( strVar.c_str () );
2966
+ CVARS_GET ( " chat_position_offset_y" , strVar ); m_pChatOffsetY->SetText ( strVar.c_str () );
2967
+
2924
2968
// Interface
2925
2969
CVARS_GET ( " server_can_flash_window" , bVar ); m_pFlashWindow->SetSelected ( bVar );
2926
2970
CVARS_GET ( " allow_tray_notifications" , bVar ); m_pTrayBalloon->SetSelected ( bVar );
@@ -3220,15 +3264,26 @@ void CSettings::SaveData ( void )
3220
3264
strVar = m_pChatScaleX->GetText () + " " + m_pChatScaleY->GetText ();
3221
3265
CVARS_SET ( " chat_scale" , strVar );
3222
3266
CVARS_SET ( " chat_lines" , m_pChatLines->GetText () );
3223
- CVARS_SET ( " chat_pos_x" , m_pChatPosX->GetText () );
3224
- CVARS_SET ( " chat_pos_y" , m_pChatPosY->GetText () );
3225
3267
CVARS_SET ( " chat_width" , m_pChatWidth->GetText () );
3226
3268
CVARS_SET ( " chat_css_style_text" , m_pChatCssText->GetSelected () );
3227
3269
CVARS_SET ( " chat_css_style_background" , m_pChatCssBackground->GetSelected () );
3228
3270
CVARS_SET ( " chat_nickcompletion" , m_pChatNickCompletion->GetSelected () );
3229
3271
CVARS_SET ( " chat_line_life" , GetMilliseconds ( m_pChatLineLife ) );
3230
3272
CVARS_SET ( " chat_line_fade_out" , GetMilliseconds ( m_pChatLineFadeout ) );
3231
3273
3274
+ CVARS_SET ( " chat_position_offset_x" , m_pChatOffsetX->GetText () );
3275
+ CVARS_SET ( " chat_position_offset_y" , m_pChatOffsetY->GetText () );
3276
+ if ( CGUIListItem* pSelected = m_pChatHorizontalCombo->GetSelectedItem () )
3277
+ {
3278
+ int iSelected = ( int ) pSelected->GetData ();
3279
+ CVARS_SET ( " chat_position_horizontal" , iSelected );
3280
+ }
3281
+ if ( CGUIListItem* pSelected = m_pChatVerticalCombo->GetSelectedItem () )
3282
+ {
3283
+ int iSelected = ( int ) pSelected->GetData ();
3284
+ CVARS_SET ( " chat_position_vertical" , iSelected );
3285
+ }
3286
+
3232
3287
// Interface
3233
3288
CVARS_SET ( " server_can_flash_window" , m_pFlashWindow->GetSelected ( ) );
3234
3289
CVARS_SET ( " allow_tray_notifications" , m_pTrayBalloon->GetSelected ( ) );
@@ -3576,13 +3631,31 @@ bool CSettings::OnChatLoadPresetClick( CGUIElement* pElement )
3576
3631
{
3577
3632
}
3578
3633
}
3579
- else if ( strTag == " pos_x" )
3634
+ else if ( strTag == " position_horizontal" )
3635
+ {
3636
+ int iValue;
3637
+ pSubNode->GetTagContent ( iValue );
3638
+
3639
+ if ( iValue >= Chat::Position::Horizontal::LEFT && iValue <= Chat::Position::Horizontal::RIGHT ) {
3640
+ m_pChatHorizontalCombo->SetSelectedItemByIndex ( iValue );
3641
+ }
3642
+ }
3643
+ else if ( strTag == " position_vertical" )
3644
+ {
3645
+ int iValue;
3646
+ pSubNode->GetTagContent ( iValue );
3647
+
3648
+ if ( iValue >= Chat::Position::Vertical::TOP && iValue <= Chat::Position::Vertical::BOTTOM ) {
3649
+ m_pChatVerticalCombo->SetSelectedItemByIndex ( iValue );
3650
+ }
3651
+ }
3652
+ else if ( strTag == " offset_x" )
3580
3653
{
3581
- m_pChatPosX ->SetText ( strValue.c_str () );
3654
+ m_pChatOffsetX ->SetText ( strValue.c_str () );
3582
3655
}
3583
- else if ( strTag == " pos_y " )
3656
+ else if ( strTag == " offset_y " )
3584
3657
{
3585
- m_pChatPosY ->SetText ( strValue.c_str () );
3658
+ m_pChatOffsetY ->SetText ( strValue.c_str () );
3586
3659
}
3587
3660
else if ( strTag == " width" )
3588
3661
{
0 commit comments