1 //////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2019, The Regents of the University of California
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 // list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 // this list of conditions and the following disclaimer in the documentation
15 // and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32
33 #include "findDialog.h"
34
35 #include <QDebug>
36 #include <string>
37
38 #include "gui/gui.h"
39
40 namespace gui {
FindObjectDialog(QWidget * parent)41 FindObjectDialog::FindObjectDialog(QWidget* parent) : QDialog(parent)
42 {
43 setupUi(this);
44 }
45
accept()46 void FindObjectDialog::accept()
47 {
48 std::string pattern_to_find = findObjEdit->text().toStdString();
49 bool match_case = false;
50 bool match_regex = false;
51 if (matchCaseCheckBox->isEnabled())
52 match_case = matchCaseCheckBox->isChecked();
53 if (matchRegExCheckBox->isEnabled())
54 match_regex = matchRegExCheckBox->isChecked();
55
56 if (this->findObjType->currentText() == "Instance") {
57 Gui::get()->addSelectedInsts(pattern_to_find.c_str(),
58 match_case,
59 match_regex,
60 addToHighlightCheckBox->isChecked());
61 } else
62 Gui::get()->addSelectedNets(pattern_to_find.c_str(),
63 match_case,
64 match_regex,
65 addToHighlightCheckBox->isChecked());
66 QDialog::accept();
67 }
68
reject()69 void FindObjectDialog::reject()
70 {
71 QDialog::reject();
72 }
73
74 } // namespace gui
75