@phoenix-wing/code-core 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +14 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/pnwCaaDialogHandoff.d.ts +17 -0
- package/dist/pnwCaaDialogHandoff.d.ts.map +1 -0
- package/dist/pnwCaaDialogHandoff.js +34 -0
- package/dist/pnwCaaDialogHandoff.js.map +1 -0
- package/dist/pnwCaaEnvironment.d.ts +17 -0
- package/dist/pnwCaaEnvironment.d.ts.map +1 -0
- package/dist/pnwCaaEnvironment.js +23 -0
- package/dist/pnwCaaEnvironment.js.map +1 -0
- package/dist/pnwCodeRenamePlan.d.ts +47 -0
- package/dist/pnwCodeRenamePlan.d.ts.map +1 -0
- package/dist/pnwCodeRenamePlan.js +105 -0
- package/dist/pnwCodeRenamePlan.js.map +1 -0
- package/dist/pnwFileResultTree.d.ts +25 -0
- package/dist/pnwFileResultTree.d.ts.map +1 -0
- package/dist/pnwFileResultTree.js +37 -0
- package/dist/pnwFileResultTree.js.map +1 -0
- package/dist/pnwReorderCpp.d.ts +7 -0
- package/dist/pnwReorderCpp.d.ts.map +1 -0
- package/dist/pnwReorderCpp.js +389 -0
- package/dist/pnwReorderCpp.js.map +1 -0
- package/dist/pnwReorderHeader.d.ts +21 -0
- package/dist/pnwReorderHeader.d.ts.map +1 -0
- package/dist/pnwReorderHeader.js +896 -0
- package/dist/pnwReorderHeader.js.map +1 -0
- package/dist/pnwUuid.d.ts +25 -0
- package/dist/pnwUuid.d.ts.map +1 -0
- package/dist/pnwUuid.js +140 -0
- package/dist/pnwUuid.js.map +1 -0
- package/dist/pnwUuidReplacementPlan.d.ts +57 -0
- package/dist/pnwUuidReplacementPlan.d.ts.map +1 -0
- package/dist/pnwUuidReplacementPlan.js +101 -0
- package/dist/pnwUuidReplacementPlan.js.map +1 -0
- package/dist/pnwWorkset.d.ts +20 -0
- package/dist/pnwWorkset.d.ts.map +1 -0
- package/dist/pnwWorkset.js +51 -0
- package/dist/pnwWorkset.js.map +1 -0
- package/package.json +50 -0
- package/src/fixtures/annotation_sep.cpp +27 -0
- package/src/fixtures/caa2_wizard_section.h +17 -0
- package/src/fixtures/clang_format_class_tail.h +23 -0
- package/src/fixtures/clang_format_doubled.h +16 -0
- package/src/fixtures/clang_format_nested_markers.h +24 -0
- package/src/fixtures/clang_format_off_on.h +18 -0
- package/src/fixtures/internal_calls.cpp +29 -0
- package/src/fixtures/kevin_wizard_section.h +23 -0
- package/src/fixtures/ktalarmclock.clang-format.yaml +57 -0
- package/src/fixtures/ktca_KTCAutoCodeFrm_KTCAutoCodeUI.m_src_KTCAutoDialog.cpp +242 -0
- package/src/fixtures/ktca_KTCAutoCodeFrm_PublicInterfaces_KTCAutoDialog.h +165 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_KTCAutoCodeItf.m_src_KTCAutoAttrAccess.cpp +423 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_KTCAutoCodeItf.m_src_KTCAutoBuildGSM.cpp +105 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_KTCAutoCodeItf.m_src_KTCAutoPartDoc.cpp +121 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_PublicInterfaces_KTCAutoAttrAccess.h +310 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_PublicInterfaces_KTCAutoBuildGSM.h +56 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_PublicInterfaces_KTCAutoCatalogParam.h +52 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_PublicInterfaces_KTCAutoGSM.h +91 -0
- package/src/fixtures/ktca_KTCAutoCodeInterfaces_PublicInterfaces_KTCAutoPartDoc.h +106 -0
- package/src/fixtures/pnx_bom_analysis_cmd_min.cpp +72 -0
- package/src/fixtures/pnx_bom_analysis_param_min.h +49 -0
- package/src/fixtures/pnx_bom_param_system_split.h +39 -0
- package/src/fixtures/pnx_caa2_widget_decl.h +19 -0
- package/src/fixtures/pragma_region.h +18 -0
- package/src/index.ts +78 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class FunctionTail {
|
|
2
|
+
public:
|
|
3
|
+
void zeta();
|
|
4
|
+
void alpha();
|
|
5
|
+
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
class MemberTail {
|
|
9
|
+
private:
|
|
10
|
+
int zebra_;
|
|
11
|
+
int alpha_;
|
|
12
|
+
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class LockedWizardTail {
|
|
16
|
+
public:
|
|
17
|
+
// clang-format off
|
|
18
|
+
//START KEVIN CAA WIZARD SECTION LockedWizardTail PARAM DECLARATION
|
|
19
|
+
int TimeCounter;
|
|
20
|
+
//END KEVIN CAA WIZARD SECTION LockedWizardTail PARAM DECLARATION
|
|
21
|
+
|
|
22
|
+
// clang-format on
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef SampleClangFormatDoubled_H
|
|
2
|
+
#define SampleClangFormatDoubled_H
|
|
3
|
+
|
|
4
|
+
class SampleClangFormatDoubled {
|
|
5
|
+
public:
|
|
6
|
+
// clang-format off
|
|
7
|
+
int outer_keep_first;
|
|
8
|
+
// clang-format off
|
|
9
|
+
int inner_keep_alpha;
|
|
10
|
+
int inner_keep_beta;
|
|
11
|
+
// clang-format on
|
|
12
|
+
int outer_keep_last;
|
|
13
|
+
// clang-format on
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
#endif
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#ifndef SampleClangFormatNested_H
|
|
2
|
+
#define SampleClangFormatNested_H
|
|
3
|
+
|
|
4
|
+
class SampleClangFormatNested {
|
|
5
|
+
public:
|
|
6
|
+
void outerMethod();
|
|
7
|
+
|
|
8
|
+
public:
|
|
9
|
+
// clang-format off
|
|
10
|
+
//START KEVIN CAA WIZARD SECTION SampleNested PARAM DECLARATION
|
|
11
|
+
int KevinFirst;
|
|
12
|
+
int KevinSecond;
|
|
13
|
+
//END KEVIN CAA WIZARD SECTION SampleNested PARAM DECLARATION
|
|
14
|
+
|
|
15
|
+
//CAA2 WIZARD
|
|
16
|
+
void* _WidgetA;
|
|
17
|
+
void* _WidgetB;
|
|
18
|
+
//END CAA2 WIZARD
|
|
19
|
+
// clang-format on
|
|
20
|
+
|
|
21
|
+
void zebra();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
#endif
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#ifndef SampleClangFormat_H
|
|
2
|
+
#define SampleClangFormat_H
|
|
3
|
+
|
|
4
|
+
class SampleClangFormat {
|
|
5
|
+
public:
|
|
6
|
+
void alpha();
|
|
7
|
+
void beta();
|
|
8
|
+
|
|
9
|
+
public:
|
|
10
|
+
// clang-format off
|
|
11
|
+
int zebra_first;
|
|
12
|
+
int apple_second;
|
|
13
|
+
// clang-format on
|
|
14
|
+
|
|
15
|
+
void gamma();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
#endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @brief 回归用例:函数体内调用同类方法
|
|
3
|
+
* 验证函数体内的 ClassName::method() 调用(如 copy() 内调用 safeDelete())
|
|
4
|
+
* 不会被提取为独立函数块。
|
|
5
|
+
*/
|
|
6
|
+
#include "FooString.h"
|
|
7
|
+
|
|
8
|
+
//--------------------------------------------------------------------
|
|
9
|
+
FooString::FooString()
|
|
10
|
+
{
|
|
11
|
+
FooString::init(nullptr);
|
|
12
|
+
}
|
|
13
|
+
//--------------------------------------------------------------------
|
|
14
|
+
void FooString::init(void *ptr)
|
|
15
|
+
{
|
|
16
|
+
m_ptr = ptr;
|
|
17
|
+
if (ptr != nullptr)
|
|
18
|
+
{
|
|
19
|
+
FooString::safeDelete(m_ptr);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//----static----------------------------------------------------------------
|
|
23
|
+
void FooString::safeDelete(void *ipData)
|
|
24
|
+
{
|
|
25
|
+
if (ipData != nullptr)
|
|
26
|
+
{
|
|
27
|
+
delete[] (char *)ipData;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#ifndef SampleKevinWizard_H
|
|
2
|
+
#define SampleKevinWizard_H
|
|
3
|
+
|
|
4
|
+
class SampleKevinWizard {
|
|
5
|
+
public:
|
|
6
|
+
void setZebra(int v);
|
|
7
|
+
void getApple() const;
|
|
8
|
+
|
|
9
|
+
public:
|
|
10
|
+
// clang-format off
|
|
11
|
+
//START KEVIN CAA WIZARD SECTION SampleKevinWizard PARAM DECLARATION
|
|
12
|
+
|
|
13
|
+
/** @brief Zebra field @id 1 */
|
|
14
|
+
int ZebraField;
|
|
15
|
+
|
|
16
|
+
/** @brief Apple field @id 2 */
|
|
17
|
+
int AppleField;
|
|
18
|
+
|
|
19
|
+
//END KEVIN CAA WIZARD SECTION SampleKevinWizard PARAM DECLARATION
|
|
20
|
+
// clang-format on
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
#endif
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# version 1.0
|
|
2
|
+
BasedOnStyle: LLVM
|
|
3
|
+
Language: Cpp
|
|
4
|
+
AccessModifierOffset: -4
|
|
5
|
+
AlignAfterOpenBracket: Align
|
|
6
|
+
AlignConsecutiveAssignments: true
|
|
7
|
+
AlignConsecutiveDeclarations: true
|
|
8
|
+
AlignEscapedNewlinesLeft: true
|
|
9
|
+
AlignOperands: true
|
|
10
|
+
AlignTrailingComments: true
|
|
11
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
|
12
|
+
AllowShortBlocksOnASingleLine : false
|
|
13
|
+
AllowShortCaseLabelsOnASingleLine: false
|
|
14
|
+
AllowShortEnumsOnASingleLine: false
|
|
15
|
+
AllowShortFunctionsOnASingleLine: Empty
|
|
16
|
+
AllowShortIfStatementsOnASingleLine: true
|
|
17
|
+
AllowShortLoopsOnASingleLine: false
|
|
18
|
+
AlwaysBreakAfterDefinitionReturnType: None
|
|
19
|
+
BreakConstructorInitializersBeforeComma: true
|
|
20
|
+
BreakBeforeBraces: Custom
|
|
21
|
+
BraceWrapping:
|
|
22
|
+
AfterClass: false
|
|
23
|
+
AfterControlStatement: false
|
|
24
|
+
AfterEnum: false
|
|
25
|
+
AfterFunction: false
|
|
26
|
+
AfterNamespace: false
|
|
27
|
+
AfterObjCDeclaration: false
|
|
28
|
+
AfterStruct: false
|
|
29
|
+
AfterUnion: true
|
|
30
|
+
AfterExternBlock: false
|
|
31
|
+
BeforeCatch: true
|
|
32
|
+
BeforeElse: true
|
|
33
|
+
IndentBraces: false
|
|
34
|
+
SplitEmptyFunction: true
|
|
35
|
+
SplitEmptyRecord: true
|
|
36
|
+
SplitEmptyNamespace: true
|
|
37
|
+
#use with BraceWrapping: AfterFunction has conflict
|
|
38
|
+
#BreakBeforeBraces: Stroustrup
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
ColumnLimit: 100
|
|
42
|
+
CommentPragmas: '^ IWYU pragma:'
|
|
43
|
+
IndentCaseLabels: false
|
|
44
|
+
IndentWidth: 4
|
|
45
|
+
IndentWrappedFunctionNames: true
|
|
46
|
+
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
47
|
+
MaxEmptyLinesToKeep: 1
|
|
48
|
+
ObjCBlockIndentWidth: 4
|
|
49
|
+
ObjCSpaceAfterProperty: true
|
|
50
|
+
PointerAlignment: Left
|
|
51
|
+
SpaceAfterCStyleCast: false
|
|
52
|
+
SpaceBeforeAssignmentOperators: true
|
|
53
|
+
SpacesInContainerLiterals: true
|
|
54
|
+
SpacesInParentheses : false
|
|
55
|
+
SpacesInSquareBrackets: true
|
|
56
|
+
TabWidth: 4
|
|
57
|
+
UseTab: Never
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Copyright 2021 Kevin Time Toolkit
|
|
3
|
+
* @license MIT
|
|
4
|
+
* @author Phoenix Wing
|
|
5
|
+
* @file
|
|
6
|
+
* @version V1.0
|
|
7
|
+
* @brief
|
|
8
|
+
* @details
|
|
9
|
+
* @date 2025-12-17
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// cat
|
|
13
|
+
#include "CATApplicationFrame.h"
|
|
14
|
+
#include "CATDialogAgent.h"
|
|
15
|
+
#include "CATDlgNotify.h"
|
|
16
|
+
#include "CATDlgWindow.h"
|
|
17
|
+
#include "CATIAlias.h"
|
|
18
|
+
#include "CATLISTV_CATISpecObject.h"
|
|
19
|
+
#include "CATListOfCATUnicodeString.h"
|
|
20
|
+
#include "CATMMUIPanelStateCmd.h"
|
|
21
|
+
#include "iostream.h"
|
|
22
|
+
|
|
23
|
+
// Auto Code
|
|
24
|
+
#include "KTCAutoDialog.h"
|
|
25
|
+
#include "KTCAutoSelectorCtx.h"
|
|
26
|
+
|
|
27
|
+
//-------------------------------------------------------------------------
|
|
28
|
+
KTCAutoDialog::KTCAutoDialog(CATDialog* iParent, CATMMUIPanelStateCmd* iFatherCmd,
|
|
29
|
+
const CATString& iObjectName, CATDlgStyle iStyle)
|
|
30
|
+
// CATDialog *iParent, CATCommand *iEventMgr, const CATString& iObjectName, CATDlgStyle
|
|
31
|
+
// iStyle=NULL
|
|
32
|
+
: CATDlgDialog(iParent, iFatherCmd, iObjectName, iStyle)
|
|
33
|
+
, optionDialog_(NULL)
|
|
34
|
+
, activeField_(0)
|
|
35
|
+
, catHSO_(NULL)
|
|
36
|
+
, actionMode_(KTC::ValueNormal)
|
|
37
|
+
, selectorMap_(NULL)
|
|
38
|
+
, valueChangeNtf_(NULL) {
|
|
39
|
+
selectorMap_ = new std::map<int, KTCAutoSelectorCtx*>();
|
|
40
|
+
valueChangeNtf_ = new KTCAutoValueChangedNtf();
|
|
41
|
+
}
|
|
42
|
+
//-------------------------------------------------------------------------
|
|
43
|
+
KTCAutoDialog::~KTCAutoDialog() {
|
|
44
|
+
optionDialog_ = NULL;
|
|
45
|
+
catHSO_ = NULL;
|
|
46
|
+
// activeField_ = 0;
|
|
47
|
+
|
|
48
|
+
if (selectorMap_) {
|
|
49
|
+
KTCAutoSelectorCtx* ctx;
|
|
50
|
+
for (size_t i = 0; i < selectorMap_->size(); i++) {
|
|
51
|
+
ctx = (*selectorMap_)[ i ]; // get
|
|
52
|
+
delete ctx; // delete
|
|
53
|
+
}
|
|
54
|
+
delete selectorMap_, selectorMap_ = NULL; // �ֶ��ͷ�
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
delete valueChangeNtf_, valueChangeNtf_ = NULL; // �ֶ��ͷ�
|
|
58
|
+
}
|
|
59
|
+
//-------------------------------------------------------------------------
|
|
60
|
+
int KTCAutoDialog::ActionSubCommandReturn() {
|
|
61
|
+
// TODO ʵ�ִ���
|
|
62
|
+
cout << " - û��ʵ�� " << __FUNCTION__ << endl;
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
//-----------------------------------------------------------------------------
|
|
66
|
+
CATUnicodeString KTCAutoDialog::checkout_title(CATISpecObject_var object) {
|
|
67
|
+
if (!object) return ""; // û������
|
|
68
|
+
|
|
69
|
+
// ���ڣ��������
|
|
70
|
+
CATIAlias_var alias = object;
|
|
71
|
+
if (!!alias) // get alias
|
|
72
|
+
return alias->GetAlias();
|
|
73
|
+
else // or get display name
|
|
74
|
+
return object->GetDisplayName();
|
|
75
|
+
}
|
|
76
|
+
//-------------------------------------------------------------------------
|
|
77
|
+
int KTCAutoDialog::InitialMenuRightClick() {
|
|
78
|
+
// TODO ʵ�ִ���
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
//-------------------------------------------------------------------------
|
|
82
|
+
void KTCAutoDialog::on_show_option_dialog(CATCommand*, CATNotification*, CATCommandClientData) {
|
|
83
|
+
if (!optionDialog_) return;
|
|
84
|
+
|
|
85
|
+
// change state
|
|
86
|
+
CATULong state = (optionDialog_->GetVisibility() == CATDlgShow) ? CATDlgHide : CATDlgShow;
|
|
87
|
+
optionDialog_->SetVisibility(state);
|
|
88
|
+
}
|
|
89
|
+
//-------------------------------------------------------------------------
|
|
90
|
+
void KTCAutoDialog::register_option_dialog(CATDlgDialog* dlg) {
|
|
91
|
+
optionDialog_ = dlg;
|
|
92
|
+
}
|
|
93
|
+
//-------------------------------------------------------------------------
|
|
94
|
+
void KTCAutoDialog::register_option_dialog(CATDlgDialog* dlg, CATDlgPushButton* optionBtn) {
|
|
95
|
+
optionDialog_ = dlg;
|
|
96
|
+
// option dialog
|
|
97
|
+
if (!optionBtn) return;
|
|
98
|
+
|
|
99
|
+
AddAnalyseNotificationCB(optionBtn, optionBtn->GetPushBActivateNotification(),
|
|
100
|
+
(CATCommandMethod)&KTCAutoDialog::on_show_option_dialog, NULL);
|
|
101
|
+
|
|
102
|
+
// close
|
|
103
|
+
AddAnalyseNotificationCB(optionDialog_, optionDialog_->GetDiaCLOSENotification(),
|
|
104
|
+
(CATCommandMethod)&KTCAutoDialog::on_show_option_dialog, NULL);
|
|
105
|
+
}
|
|
106
|
+
//-------------------------------------------------------------------------
|
|
107
|
+
KTCAutoSelectorCtx* KTCAutoDialog::regitster_field(int field, CATDlgSelectorList* selector,
|
|
108
|
+
const KtString& name) {
|
|
109
|
+
if (!selector) return NULL;
|
|
110
|
+
if (!selectorMap_) selectorMap_ = new KTCAutoSelectorCtxMap(); // ��һ��ע��ʱ������map
|
|
111
|
+
|
|
112
|
+
// C++98 ��Ҫ��ʽָ������������
|
|
113
|
+
KTCAutoSelectorCtxMap::iterator it = selectorMap_->find(field);
|
|
114
|
+
if (it != selectorMap_->end()) {
|
|
115
|
+
cout << "- [ERROR] Field " << field << " already registered!" << endl;
|
|
116
|
+
return NULL; // �ҵ�Ԫ��,�Ѿ�ע�����
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// δ�ҵ�Ԫ�أ�ע��
|
|
120
|
+
KTCAutoSelectorCtx* ctx = new KTCAutoSelectorCtx(field, selector);
|
|
121
|
+
// ctx->selector = selector;
|
|
122
|
+
ctx->fieldName = name;
|
|
123
|
+
|
|
124
|
+
(*selectorMap_)[ field ] = ctx;
|
|
125
|
+
return ctx;
|
|
126
|
+
}
|
|
127
|
+
//-----------------------------------------------------------------------------
|
|
128
|
+
int KTCAutoDialog::selectorlist_setline(CATDlgSelectorList* selectorList,
|
|
129
|
+
CATISpecObject_var inputObject,
|
|
130
|
+
const CATUnicodeString& noneSel) {
|
|
131
|
+
if (!selectorList) return 1; // return error code
|
|
132
|
+
if (selectorList->GetLineCount() > 1) selectorList->ClearLine(); // clear multi line
|
|
133
|
+
|
|
134
|
+
// set diaplay name or no selection
|
|
135
|
+
if (!!inputObject) {
|
|
136
|
+
selectorList->SetLine(checkout_title(inputObject), 0, CATDlgDataModify);
|
|
137
|
+
}
|
|
138
|
+
else
|
|
139
|
+
selectorList->SetLine(noneSel, 0, CATDlgDataModify);
|
|
140
|
+
|
|
141
|
+
return 0; // ok
|
|
142
|
+
}
|
|
143
|
+
//-----------------------------------------------------------------------------
|
|
144
|
+
int KTCAutoDialog::selectorlist_setline(CATDlgSelectorList* selectorList,
|
|
145
|
+
const CATListValCATISpecObject_var& iList,
|
|
146
|
+
const CATUnicodeString& noneSel) {
|
|
147
|
+
if (!selectorList) return 1; // return error code
|
|
148
|
+
if (selectorList->GetLineCount() > 1) selectorList->ClearLine(); // clear multi line
|
|
149
|
+
|
|
150
|
+
if (iList.Size() == 0) {
|
|
151
|
+
selectorList->ClearLine(); // clear multi line
|
|
152
|
+
selectorList->SetLine(noneSel, 0, CATDlgDataModify);
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
CATISpecObject_var object;
|
|
157
|
+
CATUnicodeString title;
|
|
158
|
+
|
|
159
|
+
// loop ,list index from 1
|
|
160
|
+
for (size_t i = 1; i <= iList.Size(); i++) {
|
|
161
|
+
object = iList[ i ]; // get object
|
|
162
|
+
|
|
163
|
+
if (!!object)
|
|
164
|
+
title = checkout_title(object);
|
|
165
|
+
else
|
|
166
|
+
title = "(NULL Object)";
|
|
167
|
+
|
|
168
|
+
// selector index from 0
|
|
169
|
+
selectorList->SetLine(title, i - 1, CATDlgDataModify);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return iList.Size();
|
|
173
|
+
|
|
174
|
+
} //-----------------------------------------------------------------------------
|
|
175
|
+
//----------------------------------------
|
|
176
|
+
void KTCAutoDialog::SendValueCHangeNotification() {
|
|
177
|
+
CATCommand* cmd = GetFather(); // get command
|
|
178
|
+
if (cmd) SendNotification(cmd, valueChangeNtf_); // set notification
|
|
179
|
+
}
|
|
180
|
+
//-------------------------------------------------------------------------
|
|
181
|
+
void KTCAutoDialog::SetActiveField(int feild) {
|
|
182
|
+
if (selectorMap_ == NULL) return;
|
|
183
|
+
activeField_ = feild;
|
|
184
|
+
|
|
185
|
+
// clear other field select
|
|
186
|
+
for (KTCAutoSelectorCtxMap::iterator it = selectorMap_->begin(); it != selectorMap_->end();
|
|
187
|
+
it++) {
|
|
188
|
+
if (it->second == NULL || it->second->fieldKey == activeField_)
|
|
189
|
+
continue; // ��ǰ�ֶβ�����������
|
|
190
|
+
|
|
191
|
+
it->second->ClearSelect(); // ��������ֶε�ѡ��
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//-------------------------------------------------------------------------
|
|
195
|
+
void KTCAutoDialog::SetActiveFieldFocus() {
|
|
196
|
+
if (selectorMap_ == NULL) return;
|
|
197
|
+
KTCAutoSelectorCtxMap::iterator it = selectorMap_->find(activeField_);
|
|
198
|
+
if (it != selectorMap_->end()) it->second->SetSelect();
|
|
199
|
+
}
|
|
200
|
+
//-----------------------------------------------------------------------------
|
|
201
|
+
void KTCAutoDialog::ShowMessageBox(const CATUnicodeString& msg, CATDialog* dialog) {
|
|
202
|
+
ShowMessageBox(0, msg, dialog);
|
|
203
|
+
}
|
|
204
|
+
//-----------------------------------------------------------------------------
|
|
205
|
+
void KTCAutoDialog::ShowMessageBox(int code, const CATUnicodeString& msg, CATDialog* dialog) {
|
|
206
|
+
if (0 == code && msg.GetLengthInChar() == 0) return; // û�д�����Ϣ��������
|
|
207
|
+
|
|
208
|
+
if (!dialog) dialog = (CATApplicationFrame::GetApplicationFrame())->GetMainWindow();
|
|
209
|
+
|
|
210
|
+
// ������Ϣ֪ͨ�Ի���
|
|
211
|
+
CATDlgNotify* notify = NULL;
|
|
212
|
+
if (code != 0) { // ���
|
|
213
|
+
// message
|
|
214
|
+
CATUnicodeString num; // code
|
|
215
|
+
num.BuildFromNum(code); // code to string
|
|
216
|
+
|
|
217
|
+
// û������msg����ʾ����Ϣ��code��
|
|
218
|
+
CATUnicodeString message = "[ERROR " + num + "]\n" + msg;
|
|
219
|
+
|
|
220
|
+
// ����
|
|
221
|
+
notify = new CATDlgNotify(dialog, "Error", CATDlgNfyError);
|
|
222
|
+
notify->DisplayBlocked(message, "Error"); // ��ʾ�Ի���ģ̬��
|
|
223
|
+
}
|
|
224
|
+
else { // û�д���
|
|
225
|
+
notify = new CATDlgNotify(dialog, "Information", CATDlgNfyInformation);
|
|
226
|
+
notify->DisplayBlocked(msg, "Information"); // ��ʾ�Ի���ģ̬��
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
KTCRequestDelayedDestruction(notify); // �ͷ���Դ
|
|
230
|
+
}
|
|
231
|
+
//-----------------------------------------------------------------------------
|
|
232
|
+
void KTCAutoDialog::ShowMessageBox(int code, const KtString& msg, CATDialog* dialog) {
|
|
233
|
+
if (0 == code && msg.size() == 0) return; // û�д�����Ϣ��������
|
|
234
|
+
CATUnicodeString message = msg.str(); // �ӱ�����ת��
|
|
235
|
+
ShowMessageBox(code, message, dialog); // ����CAA��������Ϣ��
|
|
236
|
+
}
|
|
237
|
+
//-----------------------------------------------------------------------------
|
|
238
|
+
void KTCAutoDialog::ShowMessageBox(int code, const char* msg, CATDialog* dialog) {
|
|
239
|
+
if (0 == code && msg == NULL) return; // û�д�����Ϣ��������
|
|
240
|
+
CATUnicodeString message = msg; // �ӱ�����ת��
|
|
241
|
+
ShowMessageBox(code, message, dialog); // ����CAA��������Ϣ��
|
|
242
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Shanghai Kuntai Software Technology Co., Ltd. 2025
|
|
3
|
+
* @license MIT
|
|
4
|
+
* @author Phoenix Wing
|
|
5
|
+
* @file
|
|
6
|
+
* @version V1.0
|
|
7
|
+
* @brief
|
|
8
|
+
* @details
|
|
9
|
+
* @date 2025-12-17
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#ifndef KTCAutoDialog_H
|
|
13
|
+
#define KTCAutoDialog_H
|
|
14
|
+
|
|
15
|
+
// Dialog Framework
|
|
16
|
+
#include "CATDialogAgent.h"
|
|
17
|
+
#include "CATDlgDialog.h"
|
|
18
|
+
#include "CATDlgInclude.h"
|
|
19
|
+
#include "CATISpecObject.h"
|
|
20
|
+
#include "CATString.h"
|
|
21
|
+
|
|
22
|
+
// auto code
|
|
23
|
+
#include "KTCAutoCode.h"
|
|
24
|
+
#include "KTCAutoCodeUI.h"
|
|
25
|
+
#include "KTCAutoHSO.h"
|
|
26
|
+
#include "KTCAutoSelectorCtx.h"
|
|
27
|
+
#include "KTCAutoValueChangedNtf.h"
|
|
28
|
+
|
|
29
|
+
/** @brief KTCAutoDialog Dialog */
|
|
30
|
+
class ExportedByKTCAutoCodeUI KTCAutoDialog : public CATDlgDialog {
|
|
31
|
+
DeclareResource(KTCAutoDialog, CATDlgDialog);
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
KTCAutoDialog(CATDialog* iParent, CATMMUIPanelStateCmd* iFatherCmd,
|
|
35
|
+
const CATString& iObjectName, CATDlgStyle iStyle = NULL);
|
|
36
|
+
virtual ~KTCAutoDialog();
|
|
37
|
+
|
|
38
|
+
public:
|
|
39
|
+
/** @brief nodoc
|
|
40
|
+
* returned sub command, 0 for no Sub Command
|
|
41
|
+
*/
|
|
42
|
+
int ActionSubCommandReturn();
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @brief checkout title
|
|
46
|
+
* @param object input object
|
|
47
|
+
* @return title string for dialog, if null ,return ""
|
|
48
|
+
*/
|
|
49
|
+
static CATUnicodeString checkout_title(CATISpecObject_var object);
|
|
50
|
+
|
|
51
|
+
/** @brief Get Active Field */
|
|
52
|
+
inline int GetActiveField() const {
|
|
53
|
+
return activeField_;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @brief Get Active Field */
|
|
57
|
+
inline KTC::ValueActionMode GetValueMode() const {
|
|
58
|
+
return actionMode_;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @brief nodoc
|
|
63
|
+
*/
|
|
64
|
+
int InitialMenuRightClick();
|
|
65
|
+
|
|
66
|
+
/** @brief Callback on show option dialog */
|
|
67
|
+
virtual void on_show_option_dialog(CATCommand*, CATNotification*, CATCommandClientData);
|
|
68
|
+
|
|
69
|
+
/** @brief Register Parameter Dialog */
|
|
70
|
+
void register_option_dialog(CATDlgDialog* dlg);
|
|
71
|
+
|
|
72
|
+
/** @brief Register Parameter Dialog */
|
|
73
|
+
void register_option_dialog(CATDlgDialog* dlg, CATDlgPushButton* optionBtn);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @brief register field
|
|
77
|
+
* @param field field id
|
|
78
|
+
* @param selector CATDlgSelectorList pointer
|
|
79
|
+
* @param name selector name
|
|
80
|
+
* @return KTCAutoSelectorCtx pointer
|
|
81
|
+
*/
|
|
82
|
+
KTCAutoSelectorCtx* regitster_field(int field, CATDlgSelectorList* selector,
|
|
83
|
+
const KtString& name = "");
|
|
84
|
+
|
|
85
|
+
/** @brief nodoc */
|
|
86
|
+
static int selectorlist_setline(CATDlgSelectorList* selectorList,
|
|
87
|
+
CATISpecObject_var inputObject,
|
|
88
|
+
const CATUnicodeString& noneSel = "(No Selection)");
|
|
89
|
+
|
|
90
|
+
/** @brief nodoc */
|
|
91
|
+
static int selectorlist_setline(CATDlgSelectorList* selectorList,
|
|
92
|
+
const CATListValCATISpecObject_var& iList,
|
|
93
|
+
const CATUnicodeString& noneSel = "(No Selection)");
|
|
94
|
+
|
|
95
|
+
/** @brief send value change notification */
|
|
96
|
+
void SendValueCHangeNotification();
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @brief Set Accept On Notify Of Value Change
|
|
100
|
+
* @param[in] ipDialogAgent Value Change Agent
|
|
101
|
+
*/
|
|
102
|
+
virtual void SetAcceptOnNotifyOfValueChange(CATDialogAgent* ipDialogAgent) = 0;
|
|
103
|
+
|
|
104
|
+
/** @brief Set Active Field */
|
|
105
|
+
void SetActiveField(int feild);
|
|
106
|
+
|
|
107
|
+
/** @brief Set Active Field Focus */
|
|
108
|
+
void SetActiveFieldFocus();
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @brief Show Message Box
|
|
112
|
+
* @param[in] msg message
|
|
113
|
+
* @param[in] dialog Parrent dialo
|
|
114
|
+
*/
|
|
115
|
+
static void ShowMessageBox(const CATUnicodeString& msg, CATDialog* dialog = NULL);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @brief Show Message Box
|
|
119
|
+
* @param[in] code Error Code
|
|
120
|
+
* @param[in] msg message
|
|
121
|
+
* @param[in] dialog Parrent dialo
|
|
122
|
+
* @note DONOT show message if code == 0 and msg is empty
|
|
123
|
+
*/
|
|
124
|
+
static void ShowMessageBox(int code, const CATUnicodeString& msg, CATDialog* dialog = NULL);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @brief Show Message Box
|
|
128
|
+
* @param[in] code Error Code
|
|
129
|
+
* @param[in] msg Kt String, Local charset
|
|
130
|
+
* @param[in] dialog Parrent dialo
|
|
131
|
+
* @note DONOT show message if code == 0 and msg is empty
|
|
132
|
+
*/
|
|
133
|
+
static void ShowMessageBox(int code, const KtString& msg, CATDialog* dialog = NULL);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @brief Show Message Box
|
|
137
|
+
* @param[in] code Error Code
|
|
138
|
+
* @param[in] msg const char*, Local charset
|
|
139
|
+
* @param[in] dialog Parrent dialo
|
|
140
|
+
* @note DONOT show message if code == 0 and msg is empty
|
|
141
|
+
*/
|
|
142
|
+
static void ShowMessageBox(int code, const char* msg, CATDialog* dialog = NULL);
|
|
143
|
+
|
|
144
|
+
/** @brief Set Params to Dialog */
|
|
145
|
+
virtual void UpdateDialog() = 0;
|
|
146
|
+
|
|
147
|
+
/** @brief Update Params From Dialog */
|
|
148
|
+
virtual void UpdateInfos() = 0;
|
|
149
|
+
|
|
150
|
+
/** @brief Update dialog Sensitivity */
|
|
151
|
+
virtual void UpdateSensitivity() = 0;
|
|
152
|
+
|
|
153
|
+
protected:
|
|
154
|
+
public:
|
|
155
|
+
CATDlgDialog* optionDialog_; // sub dialog
|
|
156
|
+
CATHSO* catHSO_; // catia HSO
|
|
157
|
+
|
|
158
|
+
private:
|
|
159
|
+
int activeField_; // current field
|
|
160
|
+
KTC::ValueActionMode actionMode_; // action mode
|
|
161
|
+
KTCAutoSelectorCtxMap* selectorMap_; // selector map
|
|
162
|
+
KTCAutoValueChangedNtf* valueChangeNtf_; // value change notification
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
#endif
|