mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-04-19 08:58:56 +00:00
Various changes.
- apply a patch from Daniel Gibson - double-clicking a node in Decl Browser opens the decl in its own editor - SyntaxRichEditCtrl: only open the suggestion box if there are suggestions
This commit is contained in:
parent
5fba052d81
commit
8dea28a6e8
6 changed files with 21 additions and 28 deletions
|
@ -1975,7 +1975,7 @@ bool TextEditor::FindNext(const char* find, bool matchCase, bool matchWholeWords
|
|||
|
||||
bool found = false;
|
||||
|
||||
size_t findLen = std::strlen(find);
|
||||
size_t findLen = strlen(find);
|
||||
|
||||
if (searchForward)
|
||||
{
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace ImGuiTools {
|
|||
bool DeclBrowserOnToolTipNotify( void *data, PathTreeNode *item, idStr &tooltipText ) {
|
||||
return reinterpret_cast<DeclBrowser *>(data)->OnToolTipNotify( item, tooltipText );
|
||||
}
|
||||
void DeclBrowserOnTreeSelChanged( void *data ) {
|
||||
reinterpret_cast<DeclBrowser *>(data)->OnTreeSelChanged();
|
||||
void DeclBrowserOnTreeSelChanged( void *data, bool doubleClicked ) {
|
||||
reinterpret_cast<DeclBrowser *>(data)->OnTreeSelChanged( doubleClicked );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,7 +494,7 @@ bool DeclBrowser::OnToolTipNotify( PathTreeNode *item, idStr &tooltipText ) cons
|
|||
DeclBrowser::OnTreeSelChanged
|
||||
================
|
||||
*/
|
||||
void DeclBrowser::OnTreeSelChanged() {
|
||||
void DeclBrowser::OnTreeSelChanged( bool doubleClicked ) {
|
||||
|
||||
const idDecl *decl = GetSelectedDecl();
|
||||
if ( decl ) {
|
||||
|
@ -507,6 +507,10 @@ void DeclBrowser::OnTreeSelChanged() {
|
|||
findNameEdit = va( "%s/%s*", typeName.c_str(), declName.c_str() );
|
||||
statusBarText = va( "%d decls listed", numListedDecls );
|
||||
}
|
||||
|
||||
if ( doubleClicked ) {
|
||||
OnBnClickedEdit();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
void ReloadDeclarations( void );
|
||||
bool CompareDecl( PathTreeNode *item, const char *name ) const;
|
||||
bool OnToolTipNotify( PathTreeNode *item, idStr &tooltipText ) const;
|
||||
void OnTreeSelChanged();
|
||||
void OnTreeSelChanged( bool doubleClicked );
|
||||
|
||||
void Reset();
|
||||
void Draw();
|
||||
|
|
|
@ -297,7 +297,11 @@ void PathTreeCtrl::DrawNode( PathTreeNode *node, treeItemTooltip_t tooltip, tre
|
|||
if ( ImGui::TreeNodeEx( static_cast<const void *>(node), flags, "%s", node->GetLabel().c_str() ) ) {
|
||||
if ( ImGui::IsItemClicked() && !ImGui::IsItemToggledOpen() ) {
|
||||
SelectItem( node );
|
||||
selected( data );
|
||||
selected( data, false );
|
||||
}
|
||||
if ( ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked( 0 ) ) {
|
||||
SelectItem( node );
|
||||
selected( data, true );
|
||||
}
|
||||
if ( ImGui::IsItemHovered() ) {
|
||||
tooltipText.Clear();
|
||||
|
|
|
@ -132,7 +132,7 @@ ID_INLINE void idPathTreeStack::Push( PathTreeNode *item, const char *name ) {
|
|||
|
||||
typedef bool (*treeItemCompare_t)( void *data, PathTreeNode *item, const char *name );
|
||||
typedef bool (*treeItemTooltip_t)( void *data, PathTreeNode *item, idStr &tooltipText );
|
||||
typedef void (*treeItemSelected_t)( void *data );
|
||||
typedef void (*treeItemSelected_t)( void *data, bool doubleClick );
|
||||
|
||||
class PathTreeCtrl {
|
||||
public:
|
||||
|
|
|
@ -73,26 +73,6 @@ static keyWord_t defaultKeyWords[] = {
|
|||
{ NULL, vec3_origin, "" }
|
||||
};
|
||||
|
||||
/*
|
||||
BEGIN_MESSAGE_MAP(CSyntaxRichEditCtrl, CRichEditCtrl)
|
||||
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
|
||||
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
|
||||
ON_WM_GETDLGCODE()
|
||||
ON_WM_KEYDOWN()
|
||||
ON_WM_CHAR()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_MOUSEWHEEL()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_VSCROLL()
|
||||
ON_WM_SIZE()
|
||||
ON_NOTIFY_REFLECT(EN_PROTECTED, OnProtected)
|
||||
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
|
||||
ON_LBN_SELCANCEL(IDC_LISTBOX_AUTOCOMPLETE, OnAutoCompleteListBoxChange)
|
||||
ON_LBN_SELCHANGE(IDC_LISTBOX_AUTOCOMPLETE, OnAutoCompleteListBoxChange)
|
||||
ON_LBN_DBLCLK(IDC_LISTBOX_AUTOCOMPLETE, OnAutoCompleteListBoxDblClk)
|
||||
END_MESSAGE_MAP()
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
SyntaxRichEditCtrl::SyntaxRichEditCtrl
|
||||
|
@ -126,6 +106,7 @@ SyntaxRichEditCtrl::SyntaxRichEditCtrl( void )
|
|||
stringColorIndex = 0;
|
||||
stringColorLine = -1;
|
||||
autoCompleteStart = -1;
|
||||
autoCompleteListBoxSel = -1;
|
||||
autoCompleteLastKeyDownTime = 0;
|
||||
autoCompleteInput.Clear();
|
||||
autoCompleteListBoxPos = ImVec2( 0.0f, 0.0f );
|
||||
|
@ -357,7 +338,7 @@ void SyntaxRichEditCtrl::SetKeyWords( const keyWord_t kws[] ) {
|
|||
TextEditor::LanguageDefinition langDef;
|
||||
|
||||
for ( i = 0; i < numKeyWords; i++ ) {
|
||||
if ( keyWords[i].description != '\0' ) {
|
||||
if ( keyWords[i].description ) {
|
||||
TextEditor::Identifier id;
|
||||
id.mDeclaration = keyWords[i].description;
|
||||
langDef.mIdentifiers.insert( std::make_pair( std::string( keyWords[i].keyWord ), id ) );
|
||||
|
@ -637,6 +618,10 @@ void SyntaxRichEditCtrl::AutoCompleteShow( int columnIndex ) {
|
|||
ImVec2 point;
|
||||
float top, left;
|
||||
|
||||
if ( !autoCompleteListBox.Num() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
autoCompleteStart = columnIndex;
|
||||
point = scriptEdit->GetCursorScreenCoordinates();
|
||||
|
||||
|
|
Loading…
Reference in a new issue