Files
musrfit/musredit/html/classPReplaceDialog.html
T
2026-07-31 18:47:29 +00:00

605 lines
38 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>musredit: PReplaceDialog Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">musredit<span id="projectnumber">&#160;1.0.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',false);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-slots">Protected Slots</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="classPReplaceDialog-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">PReplaceDialog Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Find and replace dialog for text editing operations.
<a href="#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="PReplaceDialog_8h_source.html">PReplaceDialog.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for PReplaceDialog:</div>
<div class="dyncontent">
<div class="center"><img src="classPReplaceDialog__inherit__graph.png" border="0" usemap="#aPReplaceDialog_inherit__map" alt="Inheritance graph"/></div>
<map name="aPReplaceDialog_inherit__map" id="aPReplaceDialog_inherit__map">
<area shape="rect" title="Find and replace dialog for text editing operations." alt="" coords="46,81,161,109"/>
<area shape="rect" title=" " alt="" coords="5,5,76,33"/>
<area shape="poly" title=" " alt="" coords="64,43,94,79,90,82,60,47"/>
<area shape="rect" title=" " alt="" coords="99,5,232,33"/>
<area shape="poly" title=" " alt="" coords="147,47,116,82,112,79,143,43"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for PReplaceDialog:</div>
<div class="dyncontent">
<div class="center"><img src="classPReplaceDialog__coll__graph.png" border="0" usemap="#aPReplaceDialog_coll__map" alt="Collaboration graph"/></div>
<map name="aPReplaceDialog_coll__map" id="aPReplaceDialog_coll__map">
<area shape="rect" title="Find and replace dialog for text editing operations." alt="" coords="108,98,224,126"/>
<area shape="rect" title=" " alt="" coords="5,5,76,33"/>
<area shape="poly" title=" " alt="" coords="72,40,149,95,146,100,69,44"/>
<area shape="rect" title=" " alt="" coords="99,5,232,33"/>
<area shape="poly" title=" " alt="" coords="168,48,168,98,163,98,163,48"/>
<area shape="rect" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations." alt="" coords="256,5,388,33"/>
<area shape="poly" title=" " alt="" coords="287,44,190,100,187,95,285,39"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afdf8203e191b8d22060e6fbdf59ed03f" id="r_afdf8203e191b8d22060e6fbdf59ed03f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#afdf8203e191b8d22060e6fbdf59ed03f">PReplaceDialog</a> (<a class="el" href="structPFindReplaceData.html">PFindReplaceData</a> *data, const bool selection, QWidget *parent=nullptr)</td></tr>
<tr class="memdesc:afdf8203e191b8d22060e6fbdf59ed03f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs the find and replace dialog. <br /></td></tr>
<tr class="separator:afdf8203e191b8d22060e6fbdf59ed03f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58bda53099c81c8d7bb0162e8d54faa7" id="r_a58bda53099c81c8d7bb0162e8d54faa7"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a58bda53099c81c8d7bb0162e8d54faa7">~PReplaceDialog</a> ()</td></tr>
<tr class="memdesc:a58bda53099c81c8d7bb0162e8d54faa7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Virtual destructor. <br /></td></tr>
<tr class="separator:a58bda53099c81c8d7bb0162e8d54faa7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a57984ff7299531ccbcfddca1aeec65ec" id="r_a57984ff7299531ccbcfddca1aeec65ec"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="structPFindReplaceData.html">PFindReplaceData</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec">getData</a> ()</td></tr>
<tr class="memdesc:a57984ff7299531ccbcfddca1aeec65ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves updated find/replace parameters from the dialog. <br /></td></tr>
<tr class="separator:a57984ff7299531ccbcfddca1aeec65ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pro-slots" name="pro-slots"></a>
Protected Slots</h2></td></tr>
<tr class="memitem:acf95c13986277f72f79ee18adb6c4cf3" id="r_acf95c13986277f72f79ee18adb6c4cf3"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acf95c13986277f72f79ee18adb6c4cf3">onFindTextAvailable</a> (const QString &amp;)</td></tr>
<tr class="memdesc:acf95c13986277f72f79ee18adb6c4cf3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Slot: Handles changes to the find text input. <br /></td></tr>
<tr class="separator:acf95c13986277f72f79ee18adb6c4cf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:ab0dc421e4054b436441c8e5c8c67faba" id="r_ab0dc421e4054b436441c8e5c8c67faba"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structPFindReplaceData.html">PFindReplaceData</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab0dc421e4054b436441c8e5c8c67faba">fData</a></td></tr>
<tr class="memdesc:ab0dc421e4054b436441c8e5c8c67faba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to find/replace parameter structure storing all settings. <br /></td></tr>
<tr class="separator:ab0dc421e4054b436441c8e5c8c67faba"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Find and replace dialog for text editing operations. </p>
<p>This dialog provides a comprehensive interface for finding and replacing text within the musredit editor. It supports various search options and replacement modes to accommodate different user workflows.</p>
<dl class="section user"><dt>Search Options:</dt><dd>The dialog offers several options to refine search behavior:<ul>
<li><b>Case sensitive</b>: Match text case exactly vs. ignore case</li>
<li><b>Whole words only</b>: Match complete words vs. partial matches</li>
<li><b>From cursor</b>: Start from current position vs. from document beginning</li>
<li><b>Find backwards</b>: Search upward vs. downward</li>
<li><b>Selected text only</b>: Limit search to selection vs. entire document</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Replacement Modes:</dt><dd>Users can choose how replacements are performed:<ul>
<li><b>Replace</b>: Find and replace one occurrence at a time</li>
<li><b>Replace All</b>: Replace all occurrences without confirmation</li>
<li><b>Prompt on replace</b>: Ask for confirmation before each replacement (launches <a class="el" href="classPReplaceConfirmationDialog.html" title="Confirmation dialog for interactive find-and-replace operations.">PReplaceConfirmationDialog</a> for interactive control)</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Text Input Features:</dt><dd><ul>
<li>Combo boxes for find/replace text maintain search history</li>
<li>Previous searches are accessible via dropdown</li>
<li>Empty find text disables replace button to prevent errors</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Scope Control:</dt><dd><ul>
<li><b>Selected text checkbox</b>: Enabled only when text is selected in editor</li>
<li>When enabled, restricts operations to selection boundaries</li>
<li>When disabled/unchecked, operates on entire document</li>
</ul>
</dd></dl>
<dl class="section user"><dt>State Management:</dt><dd>The dialog uses <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> structure to:<ul>
<li>Initialize dialog controls from previous search parameters</li>
<li>Store current dialog settings for use by calling code</li>
<li>Maintain search state across multiple find/replace operations</li>
<li>Preserve user preferences between dialog invocations</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Dialog Workflow:</dt><dd><ol type="1">
<li>User opens dialog (Edit → Replace or Ctrl+H)</li>
<li>Dialog loads previous search parameters from <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a></li>
<li>User enters find text and replacement text</li>
<li>User configures search options via checkboxes</li>
<li>User clicks Replace, Replace All, or Close</li>
<li>Dialog updates <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> with current settings</li>
<li>Calling code executes requested operation using updated data</li>
</ol>
</dd></dl>
<dl class="section user"><dt>Button State Management:</dt><dd><ul>
<li>Replace button is enabled only when find text is non-empty</li>
<li>Button state updates dynamically as user types</li>
<li>Prevents execution of invalid search operations</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The dialog is modal, requiring user interaction before continuing. </dd>
<dd>
Changes to settings are only applied when user clicks Replace/Replace All. </dd>
<dd>
The dialog maintains search history through combo box items.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> Structure defining all find/replace parameters </dd>
<dd>
<a class="el" href="classPReplaceConfirmationDialog.html" title="Confirmation dialog for interactive find-and-replace operations.">PReplaceConfirmationDialog</a> For per-replacement confirmation </dd>
<dd>
musredit For the <a class="el" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627" title="Main entry point for the musredit application.">main</a> editor with text manipulation capabilities </dd></dl>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8h_source.html#l00118">118</a> of file <a class="el" href="PReplaceDialog_8h_source.html">PReplaceDialog.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="afdf8203e191b8d22060e6fbdf59ed03f" name="afdf8203e191b8d22060e6fbdf59ed03f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afdf8203e191b8d22060e6fbdf59ed03f">&#9670;&#160;</a></span>PReplaceDialog()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">PReplaceDialog::PReplaceDialog </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structPFindReplaceData.html">PFindReplaceData</a> *</td> <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool</td> <td class="paramname"><span class="paramname"><em>selection</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">QWidget *</td> <td class="paramname"><span class="paramname"><em>parent</em></span><span class="paramdefsep"> = </span><span class="paramdefval">nullptr</span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructs the find and replace dialog. </p>
<p>Constructor - Initializes the find and replace dialog.</p>
<p>Initializes the dialog with existing find/replace parameters and configures UI controls based on current editor state. The dialog is configured as modal and populates all fields from the provided data structure.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>Pointer to <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> structure containing previous search parameters and settings. The dialog reads from this structure to initialize controls and writes to it when <a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec" title="Retrieves updated find/replace parameters from the dialog.">getData()</a> is called. Must not be nullptr. </td></tr>
<tr><td class="paramname">selection</td><td>true if text is currently selected in the editor, false otherwise. Controls the enabled state of the "Selected text only" checkbox. When false, the checkbox is disabled and unchecked. </td></tr>
<tr><td class="paramname">parent</td><td>Pointer to the parent widget (typically the main editor window). If nullptr, the dialog has no parent. Parent relationship ensures proper centering and cleanup.</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> For the parameter structure definition </dd>
<dd>
<a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec" title="Retrieves updated find/replace parameters from the dialog.">getData()</a> Retrieves updated parameters after dialog use</dd></dl>
<p>Sets up the find-and-replace dialog with comprehensive search options and replacement controls. The dialog is initialized from existing search parameters and configured based on current editor state.</p>
<p><b>Initialization Process:</b></p>
<ol type="1">
<li><b>Base Class Initialization</b>: Calls QDialog constructor with parent and stores pointer to data structure</li>
<li><b>UI Setup</b>: Loads dialog layout from Qt Designer UI file including:<ul>
<li>Find text combo box with history</li>
<li>Replace text combo box with history</li>
<li>Search option checkboxes</li>
<li>Replace, Replace All, and Close buttons</li>
</ul>
</li>
<li><b>Modal Configuration</b>: Sets dialog as modal to ensure focused interaction</li>
<li><b>Replace Button Validation</b>: Disables Replace button if find text is empty, preventing invalid search operations from being initiated</li>
<li><b>Selection State Handling</b>: If no text is selected in the editor:<ul>
<li>Unchecks "Selected text only" checkbox</li>
<li>Disables the checkbox to prevent invalid configuration This provides clear visual feedback about available search scope</li>
</ul>
</li>
<li><b>Parameter Loading</b>: Populates all UI controls from <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a>:<ul>
<li><b>Find text</b>: Loaded into combo box item 0 (maintains history)</li>
<li><b>Replace text</b>: Loaded into combo box item 0 (maintains history)</li>
<li><b>Case sensitive</b>: Checkbox reflects previous setting</li>
<li><b>Whole words only</b>: Checkbox reflects previous setting</li>
<li><b>From cursor</b>: Checkbox reflects previous setting</li>
<li><b>Find backwards</b>: Checkbox reflects previous setting</li>
<li><b>Prompt on replace</b>: Checkbox reflects previous setting</li>
<li><b>Selected text</b>: Checkbox reflects previous setting (if selection exists)</li>
</ul>
</li>
</ol>
<p><b>State-Based Behavior:</b></p>
<p>The dialog adapts its initial state based on editor context:</p><ul>
<li>Empty find text → Replace button disabled</li>
<li>Non-empty find text → Replace button enabled</li>
<li>No selection → Selected text checkbox disabled and unchecked</li>
<li>Has selection → Selected text checkbox enabled, state from data</li>
</ul>
<p><b>Combo Box History:</b> The combo boxes use item 0 for the current/default text. Additional items (if present) maintain search/replace history, allowing users to quickly reuse previous patterns.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>Pointer to <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> structure containing:<ul>
<li>Previous find/replace text strings</li>
<li>All search option flags</li>
<li>Scope settings This structure is both read from (initialization) and written to (via <a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec" title="Retrieves updated find/replace parameters from the dialog.">getData()</a>) during the dialog's lifetime. Must not be nullptr.</li>
</ul>
</td></tr>
<tr><td class="paramname">selection</td><td>Indicates whether text is currently selected in the editor:<ul>
<li>true: Selected text checkbox is enabled and state loaded from data parameter, allowing search within selection</li>
<li>false: Selected text checkbox is disabled and unchecked, forcing full-document scope</li>
</ul>
</td></tr>
<tr><td class="paramname">parent</td><td>Pointer to the parent widget (typically the main musredit window). The parent relationship provides:<ul>
<li>Automatic dialog centering over parent</li>
<li>Proper z-order (dialog appears on top)</li>
<li>Consistent theme and styling</li>
<li>Automatic cleanup when parent is destroyed</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The dialog is created but not displayed by the constructor. The caller must invoke exec() to show it modally. </dd>
<dd>
The Replace button's enabled state is managed dynamically through the <a class="el" href="#acf95c13986277f72f79ee18adb6c4cf3" title="Slot: Handles changes to the find text input.">onFindTextAvailable()</a> slot as the user types. </dd>
<dd>
Combo box item 0 is used for current text; additional items could provide search history functionality. </dd>
<dd>
The selected text checkbox is handled specially: only checked if selection exists AND the data parameter indicates it should be used.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> For the complete parameter structure </dd>
<dd>
<a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec" title="Retrieves updated find/replace parameters from the dialog.">getData()</a> Retrieves updated parameters after dialog use </dd>
<dd>
<a class="el" href="#acf95c13986277f72f79ee18adb6c4cf3" title="Slot: Handles changes to the find text input.">onFindTextAvailable()</a> Manages Replace button state dynamically </dd></dl>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8cpp_source.html#l00135">135</a> of file <a class="el" href="PReplaceDialog_8cpp_source.html">PReplaceDialog.cpp</a>.</p>
</div>
</div>
<a id="a58bda53099c81c8d7bb0162e8d54faa7" name="a58bda53099c81c8d7bb0162e8d54faa7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58bda53099c81c8d7bb0162e8d54faa7">&#9670;&#160;</a></span>~PReplaceDialog()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual PReplaceDialog::~PReplaceDialog </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel virtual">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Virtual destructor. </p>
<p>Default destructor implementation. Qt's parent-child ownership system automatically handles cleanup of UI elements.</p>
<dl class="section note"><dt>Note</dt><dd>Declared virtual to ensure proper cleanup in inheritance hierarchies. </dd></dl>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8h_source.html#l00156">156</a> of file <a class="el" href="PReplaceDialog_8h_source.html">PReplaceDialog.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a57984ff7299531ccbcfddca1aeec65ec" name="a57984ff7299531ccbcfddca1aeec65ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a57984ff7299531ccbcfddca1aeec65ec">&#9670;&#160;</a></span>getData()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structPFindReplaceData.html">PFindReplaceData</a> * PReplaceDialog::getData </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel virtual">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Retrieves updated find/replace parameters from the dialog. </p>
<p>Collects all current settings from dialog UI controls and updates the internal <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> structure. This method should be called after the dialog is accepted to obtain the user's search and replace configuration.</p>
<p>The retrieved data includes:</p><ul>
<li>Find text string (from combo box current text)</li>
<li>Replacement text string (from combo box current text)</li>
<li>Case sensitive flag</li>
<li>Whole words only flag</li>
<li>From cursor flag (search starting point)</li>
<li>Find backwards flag (search direction)</li>
<li>Selected text only flag (if checkbox enabled)</li>
<li>Prompt on replace flag (confirmation mode)</li>
</ul>
<dl class="section return"><dt>Returns</dt><dd>PFindReplaceData* Pointer to the updated parameter structure. This is the same pointer passed to the constructor, with all fields updated from current dialog state.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The selected text flag is only updated if the checkbox is enabled. </dd>
<dd>
This method is typically called by the main editor after the dialog is accepted via Replace or Replace All buttons.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> For the complete parameter structure definition</dd></dl>
<p>Collects all current settings from the dialog's UI controls and updates the internal <a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> structure. This method provides a complete snapshot of the user's search and replace configuration.</p>
<p><b>Retrieved Parameters:</b></p>
<p><b>Text Strings:</b></p><ul>
<li><b>findText</b>: Current text in the find combo box (what to search for)</li>
<li><b>replaceText</b>: Current text in the replace combo box (replacement string)</li>
</ul>
<p>Both strings are retrieved using currentText(), which returns the text visible in the combo box (either from item selection or direct user input).</p>
<p><b>Search Options (Boolean Flags):</b></p><ul>
<li><b>caseSensitive</b>: true = match case exactly, false = ignore case<ul>
<li>Example: "THEORY" vs "theory" are different when true</li>
</ul>
</li>
<li><b>wholeWordsOnly</b>: true = match complete words only, false = allow partial<ul>
<li>Example: searching "fit" won't match "musrfit" when true</li>
</ul>
</li>
<li><b>fromCursor</b>: true = start from current cursor position, false = from beginning<ul>
<li>Affects where the search operation begins</li>
</ul>
</li>
<li><b>findBackwards</b>: true = search upward, false = search downward<ul>
<li>Controls search direction through the document</li>
</ul>
</li>
</ul>
<p><b>Scope Options:</b></p><ul>
<li><b>selectedText</b>: true = limit search to selection, false = entire document<ul>
<li><b>Conditional update</b>: Only updated if checkbox is enabled</li>
<li>If checkbox is disabled (no selection), this flag is not modified</li>
<li>Prevents setting invalid scope when no selection exists</li>
</ul>
</li>
</ul>
<p><b>Replacement Behavior:</b></p><ul>
<li><b>promptOnReplace</b>: true = confirm each replacement, false = replace automatically<ul>
<li>When true, <a class="el" href="classPReplaceConfirmationDialog.html" title="Confirmation dialog for interactive find-and-replace operations.">PReplaceConfirmationDialog</a> appears for each match</li>
<li>When false, replacements occur immediately (for "Replace All")</li>
</ul>
</li>
</ul>
<p><b>Conditional Logic:</b></p>
<p>The selectedText flag has special handling: </p><div class="fragment"><div class="line"><span class="keywordflow">if</span> (fSelectedText_checkBox-&gt;isEnabled())</div>
<div class="line"> <a class="code hl_variable" href="#ab0dc421e4054b436441c8e5c8c67faba">fData</a>-&gt;selectedText = fSelectedText_checkBox-&gt;isChecked();</div>
<div class="ttc" id="aclassPReplaceDialog_html_ab0dc421e4054b436441c8e5c8c67faba"><div class="ttname"><a href="#ab0dc421e4054b436441c8e5c8c67faba">PReplaceDialog::fData</a></div><div class="ttdeci">PFindReplaceData * fData</div><div class="ttdoc">Pointer to find/replace parameter structure storing all settings.</div><div class="ttdef"><b>Definition</b> <a href="PReplaceDialog_8h_source.html#l00214">PReplaceDialog.h:214</a></div></div>
</div><!-- fragment --><p>This ensures that when no selection exists (checkbox disabled), the flag retains its previous value rather than being forced to false. This prevents unintended changes to the data structure for subsequent operations where a selection might exist.</p>
<p><b>Usage Pattern:</b></p>
<p>This method is typically called by the main editor after the dialog is accepted:</p><ol type="1">
<li>User clicks Replace or Replace All button</li>
<li>Dialog is accepted (exec() returns)</li>
<li>Calling code invokes <a class="el" href="#a57984ff7299531ccbcfddca1aeec65ec" title="Retrieves updated find/replace parameters from the dialog.">getData()</a></li>
<li>Updated parameters are used to perform find/replace operation</li>
<li>Search/replace engine uses settings from returned structure</li>
</ol>
<dl class="section return"><dt>Returns</dt><dd>PFindReplaceData* Pointer to the updated parameter structure. This is the same pointer passed to the constructor, now with all fields updated from current dialog state. The caller owns this structure and is responsible for its lifetime management.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The returned pointer is never nullptr (it's the constructor parameter). </dd>
<dd>
The selectedText flag is only updated when the checkbox is enabled. </dd>
<dd>
Current combo box text is used, not necessarily a selected item, allowing users to enter new search patterns. </dd>
<dd>
This method does not validate the parameters; validation should be performed by the calling code if needed.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structPFindReplaceData.html" title="Configuration structure for find and replace operations.">PFindReplaceData</a> For the complete parameter structure definition </dd>
<dd>
<a class="el" href="#afdf8203e191b8d22060e6fbdf59ed03f" title="Constructs the find and replace dialog.">PReplaceDialog::PReplaceDialog()</a> Where the data pointer is stored </dd>
<dd>
<a class="el" href="classPReplaceConfirmationDialog.html" title="Confirmation dialog for interactive find-and-replace operations.">PReplaceConfirmationDialog</a> Used when promptOnReplace is true </dd></dl>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8cpp_source.html#l00243">243</a> of file <a class="el" href="PReplaceDialog_8cpp_source.html">PReplaceDialog.cpp</a>.</p>
</div>
</div>
<a id="acf95c13986277f72f79ee18adb6c4cf3" name="acf95c13986277f72f79ee18adb6c4cf3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf95c13986277f72f79ee18adb6c4cf3">&#9670;&#160;</a></span>onFindTextAvailable</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void PReplaceDialog::onFindTextAvailable </td>
<td>(</td>
<td class="paramtype">const QString &amp;</td> <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel protected">protected</span><span class="mlabel virtual">virtual</span><span class="mlabel slot">slot</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Slot: Handles changes to the find text input. </p>
<p>Called when the find text combo box content changes. Updates the enabled state of the Replace button based on whether the find text is empty. This prevents users from initiating invalid search operations.</p>
<p>Button state logic:</p><ul>
<li>If find text is non-empty: Enable Replace button</li>
<li>If find text is empty: Disable Replace button</li>
</ul>
<p>This provides immediate visual feedback about whether the current configuration is valid for replacement operations.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>The new text content (parameter not currently used in implementation, as the method queries the combo box directly).</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This slot is typically connected to the combo box's editTextChanged() or currentTextChanged() signal. </dd>
<dd>
The parameter is provided by Qt's signal-slot mechanism but is not used in the current implementation.</dd></dl>
<p>Called whenever the find text combo box content changes. This slot provides dynamic validation and user feedback by managing the Replace button's enabled state based on whether valid search text is present.</p>
<p><b>Validation Logic:</b></p>
<p>The method implements a simple but effective validation rule:</p><ul>
<li><b>Non-empty find text</b>: Enable Replace button<ul>
<li>Allows user to proceed with find/replace operation</li>
<li>Indicates that a valid search can be performed</li>
</ul>
</li>
<li><b>Empty find text</b>: Disable Replace button<ul>
<li>Prevents execution of meaningless search operations</li>
<li>Provides immediate visual feedback that input is required</li>
</ul>
</li>
</ul>
<p><b>User Experience Benefits:</b></p>
<ol type="1">
<li><b>Immediate Feedback</b>: Button state updates as user types, providing instant indication of whether the configuration is valid</li>
<li><b>Error Prevention</b>: Disabling the button prevents users from attempting to search for empty strings, which would either produce errors or meaningless results</li>
<li><b>Clear Affordance</b>: The disabled state clearly communicates that the find text field requires input before proceeding</li>
<li><b>Consistent Behavior</b>: Works in tandem with constructor initialization, maintaining consistent button state throughout dialog lifetime</li>
</ol>
<p><b>Signal Connection:</b></p>
<p>This slot is typically connected to one of these combo box signals:</p><ul>
<li>editTextChanged(QString): Emitted when user types or edits text</li>
<li>currentTextChanged(QString): Emitted when displayed text changes</li>
</ul>
<p>The connection is likely established in the UI file or during dialog setup.</p>
<p><b>Implementation Note:</b></p>
<p>The method receives a QString parameter (the new text) from Qt's signal-slot mechanism, but the current implementation queries the combo box directly via currentText() rather than using the parameter. This approach:</p><ul>
<li>Ensures consistency with actual combo box state</li>
<li>Avoids potential timing issues with signal delivery</li>
<li>Simplifies the logic by using a single data source</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>The new text content from the combo box. Currently unused in the implementation as the method queries the combo box directly. Parameter present to match expected slot signature for Qt signals.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This validation is purely UI-related; the actual find/replace engine may perform additional validation when the operation is executed. </dd>
<dd>
The method only affects the Replace button; the Replace All button (if different) might have separate validation logic. </dd>
<dd>
Empty string check uses QString's default comparison; whitespace-only strings are considered non-empty.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#afdf8203e191b8d22060e6fbdf59ed03f" title="Constructs the find and replace dialog.">PReplaceDialog::PReplaceDialog()</a> Where initial button state is set </dd>
<dd>
QComboBox::currentText() Method used to query combo box state </dd></dl>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8cpp_source.html#l00322">322</a> of file <a class="el" href="PReplaceDialog_8cpp_source.html">PReplaceDialog.cpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="ab0dc421e4054b436441c8e5c8c67faba" name="ab0dc421e4054b436441c8e5c8c67faba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0dc421e4054b436441c8e5c8c67faba">&#9670;&#160;</a></span>fData</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structPFindReplaceData.html">PFindReplaceData</a>* PReplaceDialog::fData</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to find/replace parameter structure storing all settings. </p>
<p class="definition">Definition at line <a class="el" href="PReplaceDialog_8h_source.html#l00214">214</a> of file <a class="el" href="PReplaceDialog_8h_source.html">PReplaceDialog.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/workspace/LMU/musrfit/src/musredit_qt6/musredit/<a class="el" href="PReplaceDialog_8h_source.html">PReplaceDialog.h</a></li>
<li>/workspace/LMU/musrfit/src/musredit_qt6/musredit/<a class="el" href="PReplaceDialog_8cpp_source.html">PReplaceDialog.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2
</small></address>
</div><!-- doc-content -->
</body>
</html>