KiCad PCB EDA Suite
Loading...
Searching...
No Matches
grid_text_button_helpers.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <wx/checkbox.h>
26#include <wx/combo.h>
27#include <wx/filedlg.h>
28#include <wx/dirdlg.h>
29#include <wx/textctrl.h>
30
31#include <bitmaps.h>
32#include <embedded_files.h>
33#include <kiway.h>
34#include <kiway_player.h>
35#include <kiway_express.h>
36#include <string_utils.h>
37#include <dialog_shim.h>
38#include <common.h>
39#include <env_paths.h>
40#include <pgm_base.h>
41#include <widgets/wx_grid.h>
44#include <eda_doc.h>
45
46
47//-------- Renderer ---------------------------------------------------------------------
48// None required; just render as normal text.
49
50
51
52//-------- Editor Base Class ------------------------------------------------------------
53//
54// Note: this implementation is an adaptation of wxGridCellChoiceEditor
55
56
58{
59 return Combo()->GetValue();
60}
61
62
63void GRID_CELL_TEXT_BUTTON::SetSize( const wxRect& aRect )
64{
65 wxRect rect( aRect );
67
68 wxGridCellEditor::SetSize( rect );
69}
70
71
72void GRID_CELL_TEXT_BUTTON::StartingKey( wxKeyEvent& event )
73{
74 // Note: this is a copy of wxGridCellTextEditor's StartingKey()
75
76 // Since this is now happening in the EVT_CHAR event EmulateKeyPress is no
77 // longer an appropriate way to get the character into the text control.
78 // Do it ourselves instead. We know that if we get this far that we have
79 // a valid character, so not a whole lot of testing needs to be done.
80
81 // wxComboCtrl inherits from wxTextEntry, so can statically cast
82 wxTextEntry* textEntry = static_cast<wxTextEntry*>( Combo() );
83 int ch;
84
85 bool isPrintable;
86
87#if wxUSE_UNICODE
88 ch = event.GetUnicodeKey();
89
90 if( ch != WXK_NONE )
91 isPrintable = true;
92 else
93#endif // wxUSE_UNICODE
94 {
95 ch = event.GetKeyCode();
96 isPrintable = ch >= WXK_SPACE && ch < WXK_START;
97 }
98
99 switch( ch )
100 {
101 case WXK_DELETE:
102 // Delete the initial character when starting to edit with DELETE.
103 textEntry->Remove( 0, 1 );
104 break;
105
106 case WXK_BACK:
107 // Delete the last character when starting to edit with BACKSPACE.
108 {
109 const long pos = textEntry->GetLastPosition();
110 textEntry->Remove( pos - 1, pos );
111 }
112 break;
113
114 default:
115 if( isPrintable )
116 textEntry->WriteText( static_cast<wxChar>( ch ) );
117
118 break;
119 }
120}
121
122
123void GRID_CELL_TEXT_BUTTON::BeginEdit( int aRow, int aCol, wxGrid* aGrid )
124{
125 auto evtHandler = static_cast< wxGridCellEditorEvtHandler* >( m_control->GetEventHandler() );
126
127 // Don't immediately end if we get a kill focus event within BeginEdit
128 evtHandler->SetInSetFocus( true );
129
130 m_value = aGrid->GetTable()->GetValue( aRow, aCol );
131
132 Combo()->SetValue( m_value );
133 Combo()->SetFocus();
134}
135
136
137bool GRID_CELL_TEXT_BUTTON::EndEdit( int, int, const wxGrid*, const wxString&, wxString *aNewVal )
138{
139 const wxString value = Combo()->GetValue();
140
141 if( value == m_value )
142 return false;
143
144 m_value = value;
145
146 if( aNewVal )
147 *aNewVal = value;
148
149 return true;
150}
151
152
153void GRID_CELL_TEXT_BUTTON::ApplyEdit( int aRow, int aCol, wxGrid* aGrid )
154{
155 aGrid->GetTable()->SetValue( aRow, aCol, m_value );
156}
157
158
160{
161 Combo()->SetValue( m_value );
162}
163
164
165#if wxUSE_VALIDATORS
166void GRID_CELL_TEXT_BUTTON::SetValidator( const wxValidator& validator )
167{
168 m_validator.reset( static_cast< wxValidator* >( validator.Clone() ) );
169}
170#endif
171
172
173class TEXT_BUTTON_SYMBOL_CHOOSER : public wxComboCtrl
174{
175public:
176 TEXT_BUTTON_SYMBOL_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg,
177 const wxString& aPreselect ) :
178 wxComboCtrl( aParent ),
179 m_dlg( aParentDlg ),
180 m_preselect( aPreselect )
181 {
182 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_library ) );
183
184 // win32 fix, avoids drawing the "native dropdown caret"
185 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
186 }
187
188protected:
189 void DoSetPopupControl( wxComboPopup* popup ) override
190 {
191 m_popup = nullptr;
192 }
193
194 wxString escapeLibId( const wxString& aRawValue )
195 {
196 wxString itemName;
197 wxString libName = aRawValue.BeforeFirst( ':', &itemName );
198 return EscapeString( libName, CTX_LIBID ) + ':' + EscapeString( itemName, CTX_LIBID );
199 }
200
201 void OnButtonClick() override
202 {
203 // pick a symbol using the symbol picker.
204 wxString rawValue = GetValue();
205
206 if( rawValue.IsEmpty() )
207 rawValue = m_preselect;
208
209 wxString symbolId = escapeLibId( rawValue );
210
211 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg ) )
212 {
213 if( frame->ShowModal( &symbolId, m_dlg ) )
214 SetValue( UnescapeString( symbolId ) );
215
216 frame->Destroy();
217 }
218 }
219
221 wxString m_preselect;
222};
223
224
225void GRID_CELL_SYMBOL_ID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
226 wxEvtHandler* aEventHandler )
227{
228 m_control = new TEXT_BUTTON_SYMBOL_CHOOSER( aParent, m_dlg, m_preselect );
230
231 wxGridCellEditor::Create( aParent, aId, aEventHandler );
232}
233
234
235class TEXT_BUTTON_FP_CHOOSER : public wxComboCtrl
236{
237public:
238 TEXT_BUTTON_FP_CHOOSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg,
239 const wxString& aSymbolNetlist, const wxString& aPreselect ) :
240 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
241 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
242 m_dlg( aParentDlg ),
243 m_preselect( aPreselect ),
244 m_symbolNetlist( aSymbolNetlist.ToStdString() )
245 {
246 m_buttonFpChooserLock = false;
247 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_library ) );
248
249 // win32 fix, avoids drawing the "native dropdown caret"
250 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
251 }
252
253protected:
254 void DoSetPopupControl( wxComboPopup* popup ) override
255 {
256 m_popup = nullptr;
257 }
258
259 void OnButtonClick() override
260 {
261 if( m_buttonFpChooserLock ) // The button to show the FP chooser is clicked, but
262 // a previous click is currently in progress.
263 return;
264
265 // Disable the button until we have finished processing it. Normally this is not an issue
266 // but if the footprint chooser is loading for the first time, it can be slow enough that
267 // multiple clicks will cause multiple instances of the footprint loader process to start
269
270 // pick a footprint using the footprint picker.
271 wxString fpid = GetValue();
272
273 if( fpid.IsEmpty() )
274 fpid = m_preselect;
275
276 if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
277 {
278 if( !m_symbolNetlist.empty() )
279 {
282 frame->KiwayMailIn( event );
283 }
284
285 if( frame->ShowModal( &fpid, m_dlg ) )
286 SetValue( fpid );
287
288 frame->Destroy();
289 }
290
291 m_buttonFpChooserLock = false;
292 }
293
294protected:
296 wxString m_preselect;
297
298 // Lock flag to lock the button to show the FP chooser
299 // true when the button is busy, waiting all footprints loaded to
300 // avoid running more than once the FP chooser
302
303 /*
304 * Symbol netlist format:
305 * pinNumber pinName <tab> pinNumber pinName...
306 * fpFilter fpFilter...
307 */
308 std::string m_symbolNetlist;
309};
310
311
312void GRID_CELL_FPID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
313 wxEvtHandler* aEventHandler )
314{
315 m_control = new TEXT_BUTTON_FP_CHOOSER( aParent, m_dlg, m_symbolNetlist, m_preselect );
317
318#if wxUSE_VALIDATORS
319 // validate text in textctrl, if validator is set
320 if ( m_validator )
321 {
322 Combo()->SetValidator( *m_validator );
323 }
324#endif
325
326 wxGridCellEditor::Create( aParent, aId, aEventHandler );
327}
328
329
330class TEXT_BUTTON_URL : public wxComboCtrl
331{
332public:
333 TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack,
334 EMBEDDED_FILES* aFiles ) :
335 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
336 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
337 m_dlg( aParentDlg ),
338 m_searchStack( aSearchStack ),
339 m_files( aFiles )
340 {
342
343 // win32 fix, avoids drawing the "native dropdown caret"
344 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
345
346 // Bind event to handle text changes
347 Bind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this );
348 }
349
351 {
352 Unbind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this );
353 }
354
355protected:
356 void DoSetPopupControl( wxComboPopup* popup ) override
357 {
358 m_popup = nullptr;
359 }
360
361 void OnButtonClick() override
362 {
364
365 wxString filename = GetValue();
366
367 if( filename.IsEmpty() || filename == wxT( "~" ) )
368 {
369 FILEDLG_OPEN_EMBED_FILE customize;
370 wxFileDialog openFileDialog( this, _( "Open file" ), "", "", "All files (*.*)|*.*",
371 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
372 openFileDialog.SetCustomizeHook( customize );
373
374 if( openFileDialog.ShowModal() == wxID_OK )
375 {
376 filename = openFileDialog.GetPath();
377 wxFileName fn( filename );
378
379 if( customize.GetEmbed() )
380 {
381 EMBEDDED_FILES::EMBEDDED_FILE* result = m_files->AddFile( fn, false );
382 SetValue( result->GetLink() );
383 }
384 else
385 {
386 SetValue( "file://" + filename );
387 }
388 }
389 }
390 else
391 {
393 }
394
396 }
397
398 void OnTextChange(wxCommandEvent& event)
399 {
401 event.Skip(); // Ensure that other handlers can process this event too
402 }
403
405 {
406 if( GetValue().IsEmpty() )
407 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
408 else
409 SetButtonBitmaps( KiBitmapBundle( BITMAPS::www ) );
410 }
411
412protected:
416};
417
418
419void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler )
420{
421 m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack, m_files );
423
424#if wxUSE_VALIDATORS
425 // validate text in textctrl, if validator is set
426 if ( m_validator )
427 Combo()->SetValidator( *m_validator );
428#endif
429
430 wxGridCellEditor::Create( aParent, aId, aEventHandler );
431}
432
433
434class TEXT_BUTTON_FILE_BROWSER : public wxComboCtrl
435{
436public:
437 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
438 wxString* aCurrentDir, const wxString& aFileFilter = wxEmptyString,
439 bool aNormalize = false,
440 const wxString& aNormalizeBasePath = wxEmptyString ) :
441 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
442 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
443 m_dlg( aParentDlg ),
444 m_grid( aGrid ),
445 m_currentDir( aCurrentDir ),
446 m_normalize( aNormalize ),
447 m_normalizeBasePath( aNormalizeBasePath ),
448 m_fileFilter( aFileFilter )
449 {
450 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
451
452 // win32 fix, avoids drawing the "native dropdown caret"
453 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
454 }
455
456 TEXT_BUTTON_FILE_BROWSER( wxWindow* aParent, DIALOG_SHIM* aParentDlg, WX_GRID* aGrid,
457 wxString* aCurrentDir,
458 std::function<wxString( WX_GRID* grid, int row )> aFileFilterFn,
459 bool aNormalize = false,
460 const wxString& aNormalizeBasePath = wxEmptyString ) :
461 wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
462 wxTE_PROCESS_ENTER | wxBORDER_NONE ),
463 m_dlg( aParentDlg ),
464 m_grid( aGrid ),
465 m_currentDir( aCurrentDir ),
466 m_normalize( aNormalize ),
467 m_normalizeBasePath( aNormalizeBasePath ),
468 m_fileFilterFn( std::move( aFileFilterFn ) )
469 {
470 SetButtonBitmaps( KiBitmapBundle( BITMAPS::small_folder ) );
471
472 // win32 fix, avoids drawing the "native dropdown caret"
473 Customize( wxCC_IFLAG_HAS_NONSTANDARD_BUTTON );
474 }
475
476
477protected:
478 void DoSetPopupControl( wxComboPopup* popup ) override
479 {
480 m_popup = nullptr;
481 }
482
483 void OnButtonClick() override
484 {
486
487 if( m_fileFilterFn )
488 m_fileFilter = m_fileFilterFn( m_grid, m_grid->GetGridCursorRow() );
489
490 wxFileName fn = GetValue();
491
492 if( fn.GetPath().IsEmpty() && m_currentDir )
493 fn.SetPath( *m_currentDir );
494 else
495 fn.SetPath( ExpandEnvVarSubstitutions( fn.GetPath(), &m_dlg->Prj() ) );
496
497 if( !m_fileFilter.IsEmpty() )
498 {
499 wxFileDialog dlg( m_dlg, _( "Select a File" ), fn.GetPath(), fn.GetFullName(),
500 m_fileFilter, wxFD_FILE_MUST_EXIST | wxFD_OPEN );
501
502 if( dlg.ShowModal() == wxID_OK )
503 {
504 wxString filePath = dlg.GetPath();
505 wxString lastPath = dlg.GetDirectory();
506 wxString relPath = wxEmptyString;
507
508 if( m_normalize )
509 {
510 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
512 lastPath = NormalizePath( dlg.GetDirectory(), &Pgm().GetLocalEnvVariables(),
514 }
515 else
516 {
517 relPath = filePath;
518 }
519
520 SetValue( relPath );
521
523 {;} // shouldn't happen, but Coverity doesn't know that
524
525 if( m_currentDir )
526 *m_currentDir = lastPath;
527 }
528 }
529 else
530 {
531 wxDirDialog dlg( m_dlg, _( "Select Path" ), fn.GetPath(),
532 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
533
534 if( dlg.ShowModal() == wxID_OK )
535 {
536 wxString filePath = dlg.GetPath();
537 wxString relPath = wxEmptyString;
538
539 if ( m_normalize )
540 {
541 relPath = NormalizePath( filePath, &Pgm().GetLocalEnvVariables(),
543 }
544 else
545 {
546 relPath = filePath;
547 }
548
549 SetValue( relPath );
550
552 {;} // shouldn't happen, but Coverity doesn't know that
553
554 *m_currentDir = relPath;
555 }
556 }
557
559 }
560
561protected:
564 wxString* m_currentDir;
567
568 wxString m_fileFilter;
569 std::function<wxString( WX_GRID* aGrid, int aRow )> m_fileFilterFn;
570};
571
572
573void GRID_CELL_PATH_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
574 wxEvtHandler* aEventHandler )
575{
576 if( m_fileFilterFn )
577 {
578 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
581 }
582 else
583 {
584 m_control = new TEXT_BUTTON_FILE_BROWSER( aParent, m_dlg, m_grid, m_currentDir,
586 }
587
589
590#if wxUSE_VALIDATORS
591 // validate text in textctrl, if validator is set
592 if ( m_validator )
593 Combo()->SetValidator( *m_validator );
594#endif
595
596 wxGridCellEditor::Create( aParent, aId, aEventHandler );
597}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:88
void CleanupAfterModalSubDialog()
void PrepareForModalSubDialog()
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
wxString GetValue() const override
wxComboCtrl * Combo() const
void StartingKey(wxKeyEvent &event) override
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *aNewVal) override
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
void SetSize(const wxRect &aRect) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
Look for files in a number of paths.
Definition: search_stack.h:43
void DoSetPopupControl(wxComboPopup *popup) override
std::function< wxString(WX_GRID *aGrid, int aRow)> m_fileFilterFn
TEXT_BUTTON_FILE_BROWSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, WX_GRID *aGrid, wxString *aCurrentDir, std::function< wxString(WX_GRID *grid, int row)> aFileFilterFn, bool aNormalize=false, const wxString &aNormalizeBasePath=wxEmptyString)
TEXT_BUTTON_FILE_BROWSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, WX_GRID *aGrid, wxString *aCurrentDir, const wxString &aFileFilter=wxEmptyString, bool aNormalize=false, const wxString &aNormalizeBasePath=wxEmptyString)
void DoSetPopupControl(wxComboPopup *popup) override
TEXT_BUTTON_FP_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aSymbolNetlist, const wxString &aPreselect)
void DoSetPopupControl(wxComboPopup *popup) override
wxString escapeLibId(const wxString &aRawValue)
TEXT_BUTTON_SYMBOL_CHOOSER(wxWindow *aParent, DIALOG_SHIM *aParentDlg, const wxString &aPreselect)
TEXT_BUTTON_URL(wxWindow *aParent, DIALOG_SHIM *aParentDlg, SEARCH_STACK *aSearchStack, EMBEDDED_FILES *aFiles)
void DoSetPopupControl(wxComboPopup *popup) override
void OnTextChange(wxCommandEvent &event)
static void CellEditorSetMargins(wxTextEntryBase *aEntry)
A helper function to set OS-specific margins for text-based cell editors.
Definition: wx_grid.cpp:77
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:646
static void CellEditorTransformSizeRect(wxRect &aRect)
A helper function to tweak sizes of text-based cell editors depending on OS.
Definition: wx_grid.cpp:85
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:351
The common library.
#define _(s)
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, EMBEDDED_FILES *aFiles)
Open a document (file) with the suitable browser.
Definition: eda_doc.cpp:62
This file is part of the common library.
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:73
Helper functions to substitute paths with environmental variables.
@ FRAME_FOOTPRINT_CHOOSER
Definition: frame_type.h:44
@ FRAME_SYMBOL_CHOOSER
Definition: frame_type.h:37
@ MAIL_SYMBOL_NETLIST
Definition: mail_type.h:45
STL namespace.
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1073
see class PGM_BASE
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
Definition: string_utils.h:54