OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/include/fsdk_baseform.h" | 7 #include "fpdfsdk/include/fsdk_baseform.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 | 873 |
874 pControl->GetOriginalBackgroundColor(iColorType, fc); | 874 pControl->GetOriginalBackgroundColor(iColorType, fc); |
875 if (iColorType > 0) | 875 if (iColorType > 0) |
876 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 876 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
877 | 877 |
878 pControl->GetOriginalBorderColor(iColorType, fc); | 878 pControl->GetOriginalBorderColor(iColorType, fc); |
879 if (iColorType > 0) | 879 if (iColorType > 0) |
880 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 880 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
881 | 881 |
882 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 882 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
883 int32_t nBorderStyle = 0; | |
884 CPWL_Dash dsBorder(3, 0, 0); | 883 CPWL_Dash dsBorder(3, 0, 0); |
885 CPWL_Color crLeftTop, crRightBottom; | 884 CPWL_Color crLeftTop, crRightBottom; |
886 | 885 |
887 switch (GetBorderStyle()) { | 886 BorderStyle nBorderStyle = GetBorderStyle(); |
888 case BBS_DASH: | 887 switch (nBorderStyle) { |
889 nBorderStyle = PBS_DASH; | 888 case BorderStyle::DASH: |
890 dsBorder = CPWL_Dash(3, 3, 0); | 889 dsBorder = CPWL_Dash(3, 3, 0); |
891 break; | 890 break; |
892 case BBS_BEVELED: | 891 case BorderStyle::BEVELED: |
893 nBorderStyle = PBS_BEVELED; | |
894 fBorderWidth *= 2; | 892 fBorderWidth *= 2; |
895 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 893 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
896 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); | 894 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); |
897 break; | 895 break; |
898 case BBS_INSET: | 896 case BorderStyle::INSET: |
899 nBorderStyle = PBS_INSET; | |
900 fBorderWidth *= 2; | 897 fBorderWidth *= 2; |
901 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); | 898 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); |
902 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); | 899 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); |
903 break; | 900 break; |
904 case BBS_UNDERLINE: | |
905 nBorderStyle = PBS_UNDERLINED; | |
906 break; | |
907 default: | 901 default: |
908 nBorderStyle = PBS_SOLID; | |
909 break; | 902 break; |
910 } | 903 } |
911 | 904 |
912 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 905 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
913 | 906 |
914 CPWL_Color crText(COLORTYPE_GRAY, 0); | 907 CPWL_Color crText(COLORTYPE_GRAY, 0); |
915 | 908 |
916 FX_FLOAT fFontSize = 12.0f; | 909 FX_FLOAT fFontSize = 12.0f; |
917 CFX_ByteString csNameTag; | 910 CFX_ByteString csNameTag; |
918 | 911 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 WriteAppearance("R", GetRotatedRect(), GetMatrix(), csAP); | 1008 WriteAppearance("R", GetRotatedRect(), GetMatrix(), csAP); |
1016 if (pRolloverIcon) | 1009 if (pRolloverIcon) |
1017 AddImageToAppearance("R", pRolloverIcon); | 1010 AddImageToAppearance("R", pRolloverIcon); |
1018 | 1011 |
1019 if (csDownCaption.IsEmpty() && !pDownIcon) { | 1012 if (csDownCaption.IsEmpty() && !pDownIcon) { |
1020 csDownCaption = csNormalCaption; | 1013 csDownCaption = csNormalCaption; |
1021 pDownIcon = pNormalIcon; | 1014 pDownIcon = pNormalIcon; |
1022 } | 1015 } |
1023 | 1016 |
1024 switch (nBorderStyle) { | 1017 switch (nBorderStyle) { |
1025 case PBS_BEVELED: { | 1018 case BorderStyle::BEVELED: { |
1026 CPWL_Color crTemp = crLeftTop; | 1019 CPWL_Color crTemp = crLeftTop; |
1027 crLeftTop = crRightBottom; | 1020 crLeftTop = crRightBottom; |
1028 crRightBottom = crTemp; | 1021 crRightBottom = crTemp; |
1029 } break; | 1022 break; |
1030 case PBS_INSET: | 1023 } |
| 1024 case BorderStyle::INSET: { |
1031 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); | 1025 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); |
1032 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1026 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1033 break; | 1027 break; |
| 1028 } |
| 1029 default: |
| 1030 break; |
1034 } | 1031 } |
1035 | 1032 |
1036 font_map.SetAPType("D"); | 1033 font_map.SetAPType("D"); |
1037 | 1034 |
1038 csAP = CPWL_Utils::GetRectFillAppStream( | 1035 csAP = CPWL_Utils::GetRectFillAppStream( |
1039 rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) + | 1036 rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) + |
1040 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1037 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1041 crLeftTop, crRightBottom, | 1038 crLeftTop, crRightBottom, |
1042 nBorderStyle, dsBorder) + | 1039 nBorderStyle, dsBorder) + |
1043 CPWL_Utils::GetPushButtonAppStream( | 1040 CPWL_Utils::GetPushButtonAppStream( |
(...skipping 17 matching lines...) Expand all Loading... |
1061 | 1058 |
1062 pControl->GetOriginalBackgroundColor(iColorType, fc); | 1059 pControl->GetOriginalBackgroundColor(iColorType, fc); |
1063 if (iColorType > 0) | 1060 if (iColorType > 0) |
1064 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1061 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1065 | 1062 |
1066 pControl->GetOriginalBorderColor(iColorType, fc); | 1063 pControl->GetOriginalBorderColor(iColorType, fc); |
1067 if (iColorType > 0) | 1064 if (iColorType > 0) |
1068 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1065 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1069 | 1066 |
1070 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1067 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1071 int32_t nBorderStyle = 0; | |
1072 CPWL_Dash dsBorder(3, 0, 0); | 1068 CPWL_Dash dsBorder(3, 0, 0); |
1073 CPWL_Color crLeftTop, crRightBottom; | 1069 CPWL_Color crLeftTop, crRightBottom; |
1074 | 1070 |
1075 switch (GetBorderStyle()) { | 1071 BorderStyle nBorderStyle = GetBorderStyle(); |
1076 case BBS_DASH: | 1072 switch (nBorderStyle) { |
1077 nBorderStyle = PBS_DASH; | 1073 case BorderStyle::DASH: |
1078 dsBorder = CPWL_Dash(3, 3, 0); | 1074 dsBorder = CPWL_Dash(3, 3, 0); |
1079 break; | 1075 break; |
1080 case BBS_BEVELED: | 1076 case BorderStyle::BEVELED: |
1081 nBorderStyle = PBS_BEVELED; | |
1082 fBorderWidth *= 2; | 1077 fBorderWidth *= 2; |
1083 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 1078 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
1084 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); | 1079 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); |
1085 break; | 1080 break; |
1086 case BBS_INSET: | 1081 case BorderStyle::INSET: |
1087 nBorderStyle = PBS_INSET; | |
1088 fBorderWidth *= 2; | 1082 fBorderWidth *= 2; |
1089 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); | 1083 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); |
1090 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); | 1084 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); |
1091 break; | 1085 break; |
1092 case BBS_UNDERLINE: | |
1093 nBorderStyle = PBS_UNDERLINED; | |
1094 break; | |
1095 default: | 1086 default: |
1096 nBorderStyle = PBS_SOLID; | |
1097 break; | 1087 break; |
1098 } | 1088 } |
1099 | 1089 |
1100 CFX_FloatRect rcWindow = GetRotatedRect(); | 1090 CFX_FloatRect rcWindow = GetRotatedRect(); |
1101 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 1091 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
1102 | 1092 |
1103 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); | 1093 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); |
1104 if (da.HasColor()) { | 1094 if (da.HasColor()) { |
1105 da.GetColor(iColorType, fc); | 1095 da.GetColor(iColorType, fc); |
1106 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1096 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
(...skipping 29 matching lines...) Expand all Loading... |
1136 | 1126 |
1137 CFX_ByteString csAP_N_ON = | 1127 CFX_ByteString csAP_N_ON = |
1138 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + | 1128 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + |
1139 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1129 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1140 crLeftTop, crRightBottom, nBorderStyle, | 1130 crLeftTop, crRightBottom, nBorderStyle, |
1141 dsBorder); | 1131 dsBorder); |
1142 | 1132 |
1143 CFX_ByteString csAP_N_OFF = csAP_N_ON; | 1133 CFX_ByteString csAP_N_OFF = csAP_N_ON; |
1144 | 1134 |
1145 switch (nBorderStyle) { | 1135 switch (nBorderStyle) { |
1146 case PBS_BEVELED: { | 1136 case BorderStyle::BEVELED: { |
1147 CPWL_Color crTemp = crLeftTop; | 1137 CPWL_Color crTemp = crLeftTop; |
1148 crLeftTop = crRightBottom; | 1138 crLeftTop = crRightBottom; |
1149 crRightBottom = crTemp; | 1139 crRightBottom = crTemp; |
1150 } break; | 1140 break; |
1151 case PBS_INSET: | 1141 } |
| 1142 case BorderStyle::INSET: { |
1152 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); | 1143 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); |
1153 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1144 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1154 break; | 1145 break; |
| 1146 } |
| 1147 default: |
| 1148 break; |
1155 } | 1149 } |
1156 | 1150 |
1157 CFX_ByteString csAP_D_ON = | 1151 CFX_ByteString csAP_D_ON = |
1158 CPWL_Utils::GetRectFillAppStream( | 1152 CPWL_Utils::GetRectFillAppStream( |
1159 rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) + | 1153 rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) + |
1160 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1154 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1161 crLeftTop, crRightBottom, nBorderStyle, | 1155 crLeftTop, crRightBottom, nBorderStyle, |
1162 dsBorder); | 1156 dsBorder); |
1163 | 1157 |
1164 CFX_ByteString csAP_D_OFF = csAP_D_ON; | 1158 CFX_ByteString csAP_D_OFF = csAP_D_ON; |
(...skipping 22 matching lines...) Expand all Loading... |
1187 | 1181 |
1188 pControl->GetOriginalBackgroundColor(iColorType, fc); | 1182 pControl->GetOriginalBackgroundColor(iColorType, fc); |
1189 if (iColorType > 0) | 1183 if (iColorType > 0) |
1190 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1184 crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1191 | 1185 |
1192 pControl->GetOriginalBorderColor(iColorType, fc); | 1186 pControl->GetOriginalBorderColor(iColorType, fc); |
1193 if (iColorType > 0) | 1187 if (iColorType > 0) |
1194 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1188 crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
1195 | 1189 |
1196 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1190 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1197 int32_t nBorderStyle = 0; | |
1198 CPWL_Dash dsBorder(3, 0, 0); | 1191 CPWL_Dash dsBorder(3, 0, 0); |
1199 CPWL_Color crLeftTop, crRightBottom; | 1192 CPWL_Color crLeftTop, crRightBottom; |
1200 | 1193 |
1201 switch (GetBorderStyle()) { | 1194 BorderStyle nBorderStyle = GetBorderStyle(); |
1202 case BBS_DASH: | 1195 switch (nBorderStyle) { |
1203 nBorderStyle = PBS_DASH; | 1196 case BorderStyle::DASH: |
1204 dsBorder = CPWL_Dash(3, 3, 0); | 1197 dsBorder = CPWL_Dash(3, 3, 0); |
1205 break; | 1198 break; |
1206 case BBS_BEVELED: | 1199 case BorderStyle::BEVELED: |
1207 nBorderStyle = PBS_BEVELED; | |
1208 fBorderWidth *= 2; | 1200 fBorderWidth *= 2; |
1209 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 1201 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
1210 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); | 1202 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); |
1211 break; | 1203 break; |
1212 case BBS_INSET: | 1204 case BorderStyle::INSET: |
1213 nBorderStyle = PBS_INSET; | |
1214 fBorderWidth *= 2; | 1205 fBorderWidth *= 2; |
1215 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); | 1206 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); |
1216 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); | 1207 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); |
1217 break; | 1208 break; |
1218 case BBS_UNDERLINE: | |
1219 nBorderStyle = PBS_UNDERLINED; | |
1220 break; | |
1221 default: | 1209 default: |
1222 nBorderStyle = PBS_SOLID; | |
1223 break; | 1210 break; |
1224 } | 1211 } |
1225 | 1212 |
1226 CFX_FloatRect rcWindow = GetRotatedRect(); | 1213 CFX_FloatRect rcWindow = GetRotatedRect(); |
1227 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 1214 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
1228 | 1215 |
1229 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); | 1216 CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); |
1230 if (da.HasColor()) { | 1217 if (da.HasColor()) { |
1231 da.GetColor(iColorType, fc); | 1218 da.GetColor(iColorType, fc); |
1232 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1219 crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
(...skipping 26 matching lines...) Expand all Loading... |
1259 } else { | 1246 } else { |
1260 nStyle = PCS_CIRCLE; | 1247 nStyle = PCS_CIRCLE; |
1261 } | 1248 } |
1262 | 1249 |
1263 CFX_ByteString csAP_N_ON; | 1250 CFX_ByteString csAP_N_ON; |
1264 | 1251 |
1265 CFX_FloatRect rcCenter = | 1252 CFX_FloatRect rcCenter = |
1266 CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcWindow), 1.0f); | 1253 CPWL_Utils::DeflateRect(CPWL_Utils::GetCenterSquare(rcWindow), 1.0f); |
1267 | 1254 |
1268 if (nStyle == PCS_CIRCLE) { | 1255 if (nStyle == PCS_CIRCLE) { |
1269 if (nBorderStyle == PBS_BEVELED) { | 1256 if (nBorderStyle == BorderStyle::BEVELED) { |
1270 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 1257 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
1271 crRightBottom = CPWL_Utils::SubstractColor(crBackground, 0.25f); | 1258 crRightBottom = CPWL_Utils::SubstractColor(crBackground, 0.25f); |
1272 } else if (nBorderStyle == PBS_INSET) { | 1259 } else if (nBorderStyle == BorderStyle::INSET) { |
1273 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5f); | 1260 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5f); |
1274 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75f); | 1261 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75f); |
1275 } | 1262 } |
1276 | 1263 |
1277 csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBackground) + | 1264 csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBackground) + |
1278 CPWL_Utils::GetCircleBorderAppStream( | 1265 CPWL_Utils::GetCircleBorderAppStream( |
1279 rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom, | 1266 rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom, |
1280 nBorderStyle, dsBorder); | 1267 nBorderStyle, dsBorder); |
1281 } else { | 1268 } else { |
1282 csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + | 1269 csAP_N_ON = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + |
1283 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1270 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1284 crLeftTop, crRightBottom, | 1271 crLeftTop, crRightBottom, |
1285 nBorderStyle, dsBorder); | 1272 nBorderStyle, dsBorder); |
1286 } | 1273 } |
1287 | 1274 |
1288 CFX_ByteString csAP_N_OFF = csAP_N_ON; | 1275 CFX_ByteString csAP_N_OFF = csAP_N_ON; |
1289 | 1276 |
1290 switch (nBorderStyle) { | 1277 switch (nBorderStyle) { |
1291 case PBS_BEVELED: { | 1278 case BorderStyle::BEVELED: { |
1292 CPWL_Color crTemp = crLeftTop; | 1279 CPWL_Color crTemp = crLeftTop; |
1293 crLeftTop = crRightBottom; | 1280 crLeftTop = crRightBottom; |
1294 crRightBottom = crTemp; | 1281 crRightBottom = crTemp; |
1295 } break; | 1282 break; |
1296 case PBS_INSET: | 1283 } |
| 1284 case BorderStyle::INSET: { |
1297 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); | 1285 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); |
1298 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1286 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1299 break; | 1287 break; |
| 1288 } |
| 1289 default: |
| 1290 break; |
1300 } | 1291 } |
1301 | 1292 |
1302 CFX_ByteString csAP_D_ON; | 1293 CFX_ByteString csAP_D_ON; |
1303 | 1294 |
1304 if (nStyle == PCS_CIRCLE) { | 1295 if (nStyle == PCS_CIRCLE) { |
1305 CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground, 0.25f); | 1296 CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground, 0.25f); |
1306 if (nBorderStyle == PBS_BEVELED) { | 1297 if (nBorderStyle == BorderStyle::BEVELED) { |
1307 crLeftTop = CPWL_Utils::SubstractColor(crBackground, 0.25f); | 1298 crLeftTop = CPWL_Utils::SubstractColor(crBackground, 0.25f); |
1308 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1299 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1309 crBK = crBackground; | 1300 crBK = crBackground; |
1310 } else if (nBorderStyle == PBS_INSET) { | 1301 } else if (nBorderStyle == BorderStyle::INSET) { |
1311 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); | 1302 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0); |
1312 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); | 1303 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1); |
1313 } | 1304 } |
1314 | 1305 |
1315 csAP_D_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBK) + | 1306 csAP_D_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBK) + |
1316 CPWL_Utils::GetCircleBorderAppStream( | 1307 CPWL_Utils::GetCircleBorderAppStream( |
1317 rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom, | 1308 rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom, |
1318 nBorderStyle, dsBorder); | 1309 nBorderStyle, dsBorder); |
1319 } else { | 1310 } else { |
1320 csAP_D_ON = CPWL_Utils::GetRectFillAppStream( | 1311 csAP_D_ON = CPWL_Utils::GetRectFillAppStream( |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; | 1581 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; |
1591 } | 1582 } |
1592 CPWL_Color crText = GetTextPWLColor(); | 1583 CPWL_Color crText = GetTextPWLColor(); |
1593 sBody << "BT\n" | 1584 sBody << "BT\n" |
1594 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" | 1585 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" |
1595 << "Q\nEMC\n"; | 1586 << "Q\nEMC\n"; |
1596 } | 1587 } |
1597 | 1588 |
1598 if (bCharArray) { | 1589 if (bCharArray) { |
1599 switch (GetBorderStyle()) { | 1590 switch (GetBorderStyle()) { |
1600 case BBS_SOLID: { | 1591 case BorderStyle::SOLID: { |
1601 CFX_ByteString sColor = | 1592 CFX_ByteString sColor = |
1602 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1593 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); |
1603 if (sColor.GetLength() > 0) { | 1594 if (sColor.GetLength() > 0) { |
1604 sLines << "q\n" | 1595 sLines << "q\n" |
1605 << GetBorderWidth() << " w\n" | 1596 << GetBorderWidth() << " w\n" |
1606 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1597 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) |
1607 << " 2 J 0 j\n"; | 1598 << " 2 J 0 j\n"; |
1608 | 1599 |
1609 for (int32_t i = 1; i < nMaxLen; ++i) { | 1600 for (int32_t i = 1; i < nMaxLen; ++i) { |
1610 sLines << rcClient.left + | 1601 sLines << rcClient.left + |
1611 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1602 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1612 << " " << rcClient.bottom << " m\n" | 1603 << " " << rcClient.bottom << " m\n" |
1613 << rcClient.left + | 1604 << rcClient.left + |
1614 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1605 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1615 << " " << rcClient.top << " l S\n"; | 1606 << " " << rcClient.top << " l S\n"; |
1616 } | 1607 } |
1617 | 1608 |
1618 sLines << "Q\n"; | 1609 sLines << "Q\n"; |
1619 } | 1610 } |
1620 } break; | 1611 break; |
1621 case BBS_DASH: { | 1612 } |
| 1613 case BorderStyle::DASH: { |
1622 CFX_ByteString sColor = | 1614 CFX_ByteString sColor = |
1623 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1615 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); |
1624 if (sColor.GetLength() > 0) { | 1616 if (sColor.GetLength() > 0) { |
1625 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); | 1617 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); |
1626 | 1618 |
1627 sLines << "q\n" | 1619 sLines << "q\n" |
1628 << GetBorderWidth() << " w\n" | 1620 << GetBorderWidth() << " w\n" |
1629 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1621 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) |
1630 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " | 1622 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " |
1631 << dsBorder.nPhase << " d\n"; | 1623 << dsBorder.nPhase << " d\n"; |
1632 | 1624 |
1633 for (int32_t i = 1; i < nMaxLen; ++i) { | 1625 for (int32_t i = 1; i < nMaxLen; ++i) { |
1634 sLines << rcClient.left + | 1626 sLines << rcClient.left + |
1635 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1627 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1636 << " " << rcClient.bottom << " m\n" | 1628 << " " << rcClient.bottom << " m\n" |
1637 << rcClient.left + | 1629 << rcClient.left + |
1638 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1630 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1639 << " " << rcClient.top << " l S\n"; | 1631 << " " << rcClient.top << " l S\n"; |
1640 } | 1632 } |
1641 | 1633 |
1642 sLines << "Q\n"; | 1634 sLines << "Q\n"; |
1643 } | 1635 } |
1644 } break; | 1636 break; |
| 1637 } |
| 1638 default: |
| 1639 break; |
1645 } | 1640 } |
1646 } | 1641 } |
1647 | 1642 |
1648 IFX_Edit::DelEdit(pEdit); | 1643 IFX_Edit::DelEdit(pEdit); |
1649 | 1644 |
1650 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + | 1645 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + |
1651 sLines.AsStringC() + sBody.AsStringC(); | 1646 sLines.AsStringC() + sBody.AsStringC(); |
1652 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1647 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1653 } | 1648 } |
1654 | 1649 |
1655 CFX_FloatRect CPDFSDK_Widget::GetClientRect() const { | 1650 CFX_FloatRect CPDFSDK_Widget::GetClientRect() const { |
1656 CFX_FloatRect rcWindow = GetRotatedRect(); | 1651 CFX_FloatRect rcWindow = GetRotatedRect(); |
1657 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1652 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1658 switch (GetBorderStyle()) { | 1653 switch (GetBorderStyle()) { |
1659 case BBS_BEVELED: | 1654 case BorderStyle::BEVELED: |
1660 case BBS_INSET: | 1655 case BorderStyle::INSET: |
1661 fBorderWidth *= 2.0f; | 1656 fBorderWidth *= 2.0f; |
1662 break; | 1657 break; |
| 1658 default: |
| 1659 break; |
1663 } | 1660 } |
1664 | 1661 |
1665 return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); | 1662 return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); |
1666 } | 1663 } |
1667 | 1664 |
1668 CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const { | 1665 CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const { |
1669 CFX_FloatRect rectAnnot = GetRect(); | 1666 CFX_FloatRect rectAnnot = GetRect(); |
1670 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 1667 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
1671 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 1668 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
1672 | 1669 |
(...skipping 22 matching lines...) Expand all Loading... |
1695 return ""; | 1692 return ""; |
1696 } | 1693 } |
1697 | 1694 |
1698 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { | 1695 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { |
1699 CFX_FloatRect rcWindow = GetRotatedRect(); | 1696 CFX_FloatRect rcWindow = GetRotatedRect(); |
1700 CPWL_Color crBorder = GetBorderPWLColor(); | 1697 CPWL_Color crBorder = GetBorderPWLColor(); |
1701 CPWL_Color crBackground = GetFillPWLColor(); | 1698 CPWL_Color crBackground = GetFillPWLColor(); |
1702 CPWL_Color crLeftTop, crRightBottom; | 1699 CPWL_Color crLeftTop, crRightBottom; |
1703 | 1700 |
1704 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 1701 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
1705 int32_t nBorderStyle = 0; | |
1706 CPWL_Dash dsBorder(3, 0, 0); | 1702 CPWL_Dash dsBorder(3, 0, 0); |
1707 | 1703 |
1708 switch (GetBorderStyle()) { | 1704 BorderStyle nBorderStyle = GetBorderStyle(); |
1709 case BBS_DASH: | 1705 switch (nBorderStyle) { |
1710 nBorderStyle = PBS_DASH; | 1706 case BorderStyle::DASH: |
1711 dsBorder = CPWL_Dash(3, 3, 0); | 1707 dsBorder = CPWL_Dash(3, 3, 0); |
1712 break; | 1708 break; |
1713 case BBS_BEVELED: | 1709 case BorderStyle::BEVELED: |
1714 nBorderStyle = PBS_BEVELED; | |
1715 fBorderWidth *= 2; | 1710 fBorderWidth *= 2; |
1716 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); | 1711 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1); |
1717 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); | 1712 crRightBottom = CPWL_Utils::DevideColor(crBackground, 2); |
1718 break; | 1713 break; |
1719 case BBS_INSET: | 1714 case BorderStyle::INSET: |
1720 nBorderStyle = PBS_INSET; | |
1721 fBorderWidth *= 2; | 1715 fBorderWidth *= 2; |
1722 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); | 1716 crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5); |
1723 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); | 1717 crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75); |
1724 break; | 1718 break; |
1725 case BBS_UNDERLINE: | |
1726 nBorderStyle = PBS_UNDERLINED; | |
1727 break; | |
1728 default: | 1719 default: |
1729 nBorderStyle = PBS_SOLID; | |
1730 break; | 1720 break; |
1731 } | 1721 } |
1732 | 1722 |
1733 return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 1723 return CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
1734 crLeftTop, crRightBottom, nBorderStyle, | 1724 crLeftTop, crRightBottom, nBorderStyle, |
1735 dsBorder); | 1725 dsBorder); |
1736 } | 1726 } |
1737 | 1727 |
1738 CFX_Matrix CPDFSDK_Widget::GetMatrix() const { | 1728 CFX_Matrix CPDFSDK_Widget::GetMatrix() const { |
1739 CFX_Matrix mt; | 1729 CFX_Matrix mt; |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 break; | 2809 break; |
2820 } | 2810 } |
2821 } | 2811 } |
2822 } | 2812 } |
2823 | 2813 |
2824 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { | 2814 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { |
2825 CFX_FloatRect rcAnnot; | 2815 CFX_FloatRect rcAnnot; |
2826 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2816 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2827 return rcAnnot; | 2817 return rcAnnot; |
2828 } | 2818 } |
OLD | NEW |